覆盖设计路线

时间:2015-02-08 18:58:43

标签: ruby-on-rails ruby-on-rails-4

  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],但它不起作用 提前谢谢。

1 个答案:

答案 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之类的所有功能都不会陷入死胡同。我不太确定,但看起来它检查每个函数的依赖关系。