问题
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