different layout for sign_in action in devise

后端 未结 8 2157
情深已故
情深已故 2020-12-02 05:12

I\'m trying to use a different/custom layout named \"devise\" for the sign_in action. I found this page in the devise wiki, and the second example even says you can do it pe

相关标签:
8条回答
  • 2020-12-02 05:48

    Just incase you didn't know, you can also use rake routes to see the routes in your rails app along with the action/controller they map to.

     new_user_registration GET    /accounts/sign_up(.:format)       {:action=>"new", :controller=>"devise/registrations"}
    edit_user_registration GET    /accounts/edit(.:format)          {:action=>"edit", :controller=>"devise/registrations"}
                           PUT    /accounts(.:format)               {:action=>"update", :controller=>"devise/registrations"}
                           DELETE /accounts(.:format)               {:action=>"destroy", :controller=>"devise/registrations"}
    
    0 讨论(0)
  • 2020-12-02 05:52

    Here's a one-liner for those who want all devise actions to use a new layout:

    class ApplicationController < ActionController::Base
      protect_from_forgery
    
      layout Proc.new { |controller| controller.devise_controller? ? 'devise' : 'application' }
    end
    
    0 讨论(0)
提交回复
热议问题