aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/caching/sweeping.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-08 01:05:53 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-08 01:05:53 +0000
commit363a6f5de6b8625d2d671623625bcb55b7a793b9 (patch)
treeeaac523d31e96bb6bbc5b82eec183b19da29c155 /actionpack/lib/action_controller/caching/sweeping.rb
parente1173500379ab35734ac9101e58d6eff6552ef6e (diff)
downloadrails-363a6f5de6b8625d2d671623625bcb55b7a793b9.tar.gz
rails-363a6f5de6b8625d2d671623625bcb55b7a793b9.tar.bz2
rails-363a6f5de6b8625d2d671623625bcb55b7a793b9.zip
Fixed that sweepers defined by cache_sweeper will be added regardless of the perform_caching setting. Instead, control whether the sweeper should be run with the perform_caching setting. This makes testing easier when you want to turn perform_caching on/off [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8990 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/caching/sweeping.rb')
-rw-r--r--actionpack/lib/action_controller/caching/sweeping.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/caching/sweeping.rb b/actionpack/lib/action_controller/caching/sweeping.rb
index 40276a118e..3164e14f6f 100644
--- a/actionpack/lib/action_controller/caching/sweeping.rb
+++ b/actionpack/lib/action_controller/caching/sweeping.rb
@@ -36,7 +36,6 @@ module ActionController #:nodoc:
module ClassMethods #:nodoc:
def cache_sweeper(*sweepers)
- return unless perform_caching
configuration = sweepers.extract_options!
sweepers.each do |sweeper|
@@ -59,11 +58,11 @@ module ActionController #:nodoc:
def before(controller)
self.controller = controller
- callback(:before)
+ callback(:before) if controller.perform_caching
end
def after(controller)
- callback(:after)
+ callback(:after) if controller.perform_caching
# Clean up, so that the controller can be collected after this request
self.controller = nil
end