Skip to content

Instantly share code, notes, and snippets.

@twe4ked
Created April 29, 2010 04:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save twe4ked/383150 to your computer and use it in GitHub Desktop.
Save twe4ked/383150 to your computer and use it in GitHub Desktop.
One idea for giving devise's controllers their own layout
# How to give your devise controllers all the same layout (e.g. "authentication" below)
class ApplicationController < ActionController::Base
layout :setup_layout
def setup_layout
return "authentication" if
[ConfirmationsController, PasswordsController, SessionsController,
RegistrationsController, UnlocksController].include? self.class
"application"
end
end
@szajbus
Copy link

szajbus commented Apr 29, 2010

wouldn't that be cleaner?

def setup_layout
  devise_controller? ? "authentication" : "application"
end

the devise_controller? method is defined by devise, so why not use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment