Integrate layouts with Devise

有些话、适合烂在心里 提交于 2019-12-25 01:39:14

问题


I'm using devise for user auth, however, I want the registration, login, and beta code enter pages to have a layout called 'beta' not the application (default) layout that the rest of the pages have.

I normally just change the layout in the controller but there aren't controllers with Devise. Is this not possible and I just have to change the application layout and have a specific layout for all other pages?


回答1:


There are controllers in devise and they are easy to customize. Just do the following:

app/controllers/sessions_controller.rb

class Users::SessionsController < Devise::SessionsController
  layout  "beta"
end

/config/routes.rb

devise_for :users, :controllers => { :sessions => "users/sessions" }

And do the same for registration and all other pages that you want to have this layout.



来源:https://stackoverflow.com/questions/6647188/integrate-layouts-with-devise

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!