2015-01-07 60 views
2

我正在使用Devise with Invitable和Confirmable。无法在设计上覆盖after_inactive_sign_up_path_for RegistrationsController

登录时,我想将用户重定向到确认页面,而不是显示Flash消息。

我在route.rb设置如下:

devise_for :users, controllers: { 
    :confirmations => 'confirmations', 
    :registrations => 'registrations' 
} 

而且我RegistrationsController(/app/controllers/registrations_controller.rb)是:

class RegistrationsController < Devise::RegistrationsController 
    protected 

    def after_inactive_sign_up_path_for(resource) 
     "http://google.com" 
    end 
end 

但无论我怎么努力,after_inactive_sign_up_path_for没有被调用,它只是继续闪光消息。

回答

0

更改此

:registrations => 'registrations' 

:registrations => "users/registrations" 

而且,你将覆盖非活动注册,如果你想成功注册后重定向,那么你应该重写def after_sign_up_path_for(resource)

+0

我试用改变路由,但它没有工作。我不想覆盖after_inactive_sign_up_path_for,因为用户必须确认帐户,并且我想显示一个确认页面,而不仅仅是一个Flash通知。 – Dofs

+0

您是否想在注册成功后或注册失败后重定向用户? –

+0

我想在注册时重定向,但在帐户被确认之前。 – Dofs