Skip to content

Instantly share code, notes, and snippets.

@suhovius
Forked from scottwb/application_controller.rb
Created December 29, 2012 19:53
Show Gist options
  • Save suhovius/4408978 to your computer and use it in GitHub Desktop.
Save suhovius/4408978 to your computer and use it in GitHub Desktop.
# Add these methods to your ApplicationController. Then, any controller
# that inherits from it will have these methods and can programmatically
# determine what filters it has set.
class ApplicationController < ActionController::Base
def self.filters(kind = nil)
all_filters = _process_action_callbacks
all_filters = all_filters.select{|f| f.kind == kind} if kind
all_filters.map(&:filter)
end
def self.before_filters
filters(:before)
end
def self.after_filters
filters(:after)
end
def self.around_filters
filters(:around)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment