aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/filters.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-12 05:51:02 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-12 05:51:02 +0000
commit050c3964d8fe8d68c03fff593e3c09b5eae77a46 (patch)
tree9331224443d2415be34543af3a94d415c7020d31 /actionpack/lib/action_controller/filters.rb
parent838ec413ebe08be71eea3dec0b061c6f609c839f (diff)
downloadrails-050c3964d8fe8d68c03fff593e3c09b5eae77a46.tar.gz
rails-050c3964d8fe8d68c03fff593e3c09b5eae77a46.tar.bz2
rails-050c3964d8fe8d68c03fff593e3c09b5eae77a46.zip
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
Diffstat (limited to 'actionpack/lib/action_controller/filters.rb')
-rw-r--r--actionpack/lib/action_controller/filters.rb25
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