aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2011-06-22 10:48:19 -0700
committerSantiago Pastorino <santiago@wyeworks.com>2011-06-22 10:48:19 -0700
commit6b3342d971d4e127dceb351ef983ca650167518e (patch)
tree86f6de3f5be8e6aff4ff936003bc86b42a3e08d1
parenta1f8421060461251c456c72ca22bb9b1006841dc (diff)
parent93ff522120a916f49133d2f8539d904b46f8d539 (diff)
downloadrails-6b3342d971d4e127dceb351ef983ca650167518e.tar.gz
rails-6b3342d971d4e127dceb351ef983ca650167518e.tar.bz2
rails-6b3342d971d4e127dceb351ef983ca650167518e.zip
Merge pull request #1798 from jeroenj/cachesweeper-fix
Fixes an issue where cache sweepers with only after filters would have no controller object
-rw-r--r--actionpack/lib/action_controller/caching/sweeping.rb1
-rw-r--r--actionpack/test/controller/filters_test.rb5
2 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/caching/sweeping.rb b/actionpack/lib/action_controller/caching/sweeping.rb
index e9db0d97b6..938a6ae81c 100644
--- a/actionpack/lib/action_controller/caching/sweeping.rb
+++ b/actionpack/lib/action_controller/caching/sweeping.rb
@@ -61,6 +61,7 @@ module ActionController #:nodoc:
end
def after(controller)
+ self.controller = controller
callback(:after) if controller.perform_caching
# Clean up, so that the controller can be collected after this request
self.controller = nil
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb
index 9e44e8e088..d5e3da4d88 100644
--- a/actionpack/test/controller/filters_test.rb
+++ b/actionpack/test/controller/filters_test.rb
@@ -530,6 +530,11 @@ class FilterTest < ActionController::TestCase
assert sweeper.before(TestController.new)
end
+ def test_after_method_of_sweeper_should_always_return_nil
+ sweeper = ActionController::Caching::Sweeper.send(:new)
+ assert_nil sweeper.after(TestController.new)
+ end
+
def test_non_yielding_around_filters_not_returning_false_do_not_raise
controller = NonYieldingAroundFilterController.new
controller.instance_variable_set "@filter_return_value", true