Skip to content

Instantly share code, notes, and snippets.

@scottwb
Created February 17, 2012 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottwb/1851733 to your computer and use it in GitHub Desktop.
Save scottwb/1851733 to your computer and use it in GitHub Desktop.
Example module for adding custom filters to Devise controllers.
# Put this somewhere it will get auto-loaded, like config/initializers
module DeviseFilters
def self.add_filters
# Example of adding a before_filter to all the Devise controller
# actions we care about.
[
Devise::SessionsController,
Devise::RegistrationsController,
Devise::PasswordsController
].each do |controller|
controller.before_filter :prepare_for_mobile
end
# Example of adding one selective before_filter.
Devise::RegistrationsController.before_filter :check_invite_code, :only => :new
end
self.add_filters
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment