devise_for :users, :skip => [:sessions]
as :user 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
我希望能够添加get 'register' => 'devise/registrations#new', :as => :new_user_registration
,
但请注意以上代码仅跳过:sessions
我尝试了:skip => [:sessions, :registrations]
,但它不起作用
提前谢谢。
答案 0 :(得分:0)
devise_for :users, :skip => [:sessions,:registrations ]
as :user 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
post 'users' => 'devise/registrations#create', :as => :user_registration
get 'register' => 'devise/registrations#new', :as => :new_user_registration
end
通过加入post 'users'....
来解决问题
因为我相信rails确保registrations#create
之类的所有功能都不会陷入死胡同。我不太确定,但看起来它检查每个函数的依赖关系。