different layout for sign_in action in devise

后端 未结 8 2170
情深已故
情深已故 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条回答
  •  Happy的楠姐
    2020-12-02 05:27

    Surprised to not see this answer anywhere, but you can also do this:

    In routes.rb, change your devise config to look something like this:

      devise_for :users, controllers: {
        sessions: 'sessions'
      }
    

    Then in app/controllers/sessions_controller.rb

    class SessionsController < Devise::SessionsController
      layout 'devise', only: [:new]
    end
    

    This is especially useful if you need to do additional logic overrides in any of the Devise controllers.

提交回复
热议问题