24

成功注册后,我正在按照此操作方法修改确认页面。

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-(注册)

我按照它说的做所有事情,但我收到了这个错误:

in `add_route': Invalid route name, already in use: 'new_user_session'  (ArgumentError)
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here: 
http://guides.rubyonrails.org/routing.html#restricting-the-routes-created

我猜 wiki 没有更新为使用带有 Rails 4 的 Devise,但我没有找到足够的信息来修复错误。

返回错误的行是下一个(routes.rb):

devise_for :users, :controllers => { :registrations => "registrations" }

有什么建议吗?

谢谢。

编辑 -

注册控制器.rb

class RegistrationsController < Devise::RegistrationsController

    protected

    def after_inactive_sign_up_path_for(resource)
        '/sign_up/inactive'
    end
end

路线.rb

root :to => 'home#index'
devise_for :users
resources :users

devise_for :users, :controllers => { :registrations => "registrations" }
4

1 回答 1

61

您的 routes.rb 中有两条路线devise_for :users- 删除第一条。

于 2013-08-02T13:29:53.693 回答