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

Rails 4でDeviseを使用するためにwikiが更新されていないと思いますが、エラーを修正するのに十分な情報が見つかりません。

エラーを返している行は次のとおりです (routes.rb):

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

なにか提案を?

ありがとう。

編集 -

registrations_controller.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

devise_for :usersroutes.rb に2 つのルートがあります - 最初のルートを削除します。

于 2013-08-02T13:29:53.693 に答える