From 050c3964d8fe8d68c03fff593e3c09b5eae77a46 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Feb 2006 05:51:02 +0000 Subject: Stopped the massive bleeding of concerns into ActionController::Base. Base no longer knows about flash, filters, or components. This may well have introduced some instability, please do test with apps, especially the ones using components. [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3580 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/filters.rb | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'actionpack/lib/action_controller/filters.rb') 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 -- cgit v1.2.3