Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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