我试图覆盖两个控制器用于设计,但是,因此,只有routes.rb中第一个列出的控制器被覆盖
devise_for :users, :controllers => { :sessions => "users/sessions" }
devise_for :users, :controllers => { :registrations => "users/registrations" }
我得到的是:
new_user_session GET /users/sign_in(.:format) users/sessions#new
user_session POST /users/sign_in(.:format) users/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) users/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
如果我首先列出注册控制器,它将起作用,但会话控制器不会,
有什么想法吗?
答案 0 :(得分:1)
您定义路线的方式不起作用。由于rails将用于首次匹配的路由。您可以按如下方式重写:
devise_for :users, :controllers => { :sessions => "users/sessions", :registrations => "users/registrations" }
然后它应该工作。