17
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RailsのDeviseでログイン関係のlayoutを変更する

Posted at

How To: Create custom layouts
https://github.com/plataformatec/devise/wiki/How-To:-Create-custom-layouts

に書いてある。
いくつか方法がありdevise_controller?というメソッドを使ってコントローラのフィルターにする方法が最初に掲載されているが、なんか気持ち悪いのでconfigで変更する方法を使った。

config.to_prepare do
  Devise::SessionsController.layout "devise"
  Devise::RegistrationsController.layout proc{ |controller| user_signed_in? ? "application" : "devise" }
  Devise::ConfirmationsController.layout "devise"
  Devise::UnlocksController.layout "devise"            
  Devise::PasswordsController.layout "devise"        
end
17
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?