diff options
Diffstat (limited to 'actionpack/lib/action_controller/filters.rb')
-rw-r--r-- | actionpack/lib/action_controller/filters.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb index 820eca1754..008486751d 100644 --- a/actionpack/lib/action_controller/filters.rb +++ b/actionpack/lib/action_controller/filters.rb @@ -335,23 +335,35 @@ module ActionController #:nodoc: end module InstanceMethods # :nodoc: - def self.append_features(base) - super - base.class_eval { + def self.included(base) + base.class_eval do alias_method :perform_action_without_filters, :perform_action alias_method :perform_action, :perform_action_with_filters - } + + alias_method :process_without_filters, :process + alias_method :process, :process_with_filters + + alias_method :process_cleanup_without_filters, :process_cleanup + alias_method :process_cleanup, :process_cleanup_with_filters + end end def perform_action_with_filters before_action_result = before_action + unless before_action_result == false || performed? perform_action_without_filters after_action end + @before_filter_chain_aborted = (before_action_result == false) end + def process_with_filters(request, response, method = :perform_action, *arguments) #:nodoc: + @before_filter_chain_aborted = false + process_without_filters(request, response, method, *arguments) + end + # Calls all the defined before-filter filters, which are added by using "before_filter :method". # If any of the filters return false, no more filters will be executed and the action is aborted. def before_action #:doc: @@ -368,6 +380,7 @@ module ActionController #:nodoc: def call_filters(filters) filters.each do |filter| next if action_exempted?(filter) + filter_result = case when filter.is_a?(Symbol) self.send(filter) @@ -405,6 +418,10 @@ module ActionController #:nodoc: ea.include?(action_name) end end + + def process_cleanup_with_filters + process_cleanup_without_filters unless @before_filter_chain_aborted + end end end end |