Created
February 17, 2012 08:06
-
-
Save scottwb/1851733 to your computer and use it in GitHub Desktop.
Example module for adding custom filters to Devise controllers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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