Permalink
Browse files

Restore the more readable before_ and after_filters methods since the…

…y aren't called frequently
  • Loading branch information...
1 parent 3037022 commit 2167f95d857224b88901c5fb4cda63c2e0756676 @jeremy jeremy committed Jul 9, 2008
Showing with 2 additions and 10 deletions.
  1. +2 −10 actionpack/lib/action_controller/filters.rb
@@ -569,21 +569,13 @@ def filter_chain
# Returns all the before filters for this class and all its ancestors.
# This method returns the actual filter that was assigned in the controller to maintain existing functionality.
def before_filters #:nodoc:
- filters = []
- filter_chain.each do |filter|
- filters << filter.method if filter.before?
- end
- filters
+ filter_chain.select(&:before?).map(&:method)
end
# Returns all the after filters for this class and all its ancestors.
# This method returns the actual filter that was assigned in the controller to maintain existing functionality.
def after_filters #:nodoc:
- filters = []
- filter_chain.each do |filter|
- filters << filter.method if filter.after?
- end
- filters
+ filter_chain.select(&:after?).map(&:method)
end
end

0 comments on commit 2167f95

Please sign in to comment.