尝试使用设计范围重新定义会话路由时出错。
devise_for :users
devise_scope :users do
get '/login' => 'devise/sessions#new', as: :new_user_session
post '/login' => 'devise/sessions#create', as: :user_session
delete '/logout' => 'devise/sessions#destroy', as: :destroy_user_session
end
错误。
Invalid route name, already in use: 'new_user_session' 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
我理解错误只是不知道为什么会发生。范围不会重新定义为 new_user_session 吗?
此外,如果您关注 wiki,您将收到关于传递块的设计弃用警告。 https://github.com/plataformatec/devise/wiki/How-To:-Change-the-default-sign_in-and-sign_out-routes