From 0121377cfb864e3a455280ff00531c4b066848bb Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Tue, 8 Jan 2013 12:02:11 -0700 Subject: evaluate the dependency blocks at the instance level, not class level --- actionpack/lib/action_controller/caching.rb | 6 +----- actionpack/test/controller/caching_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index e31743bcc7..76b0048529 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -80,10 +80,6 @@ module ActionController def view_cache_dependency(&dependency) self._view_cache_dependencies += [dependency] end - - def view_cache_dependencies - _view_cache_dependencies.map { |dep| instance_exec &dep }.compact - end end def caching_allowed? @@ -91,7 +87,7 @@ module ActionController end def view_cache_dependencies - self.class.view_cache_dependencies + self.class._view_cache_dependencies.map { |dep| instance_exec &dep }.compact end protected diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index eb5eeb0423..ca86837a2c 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -306,11 +306,11 @@ class ViewCacheDependencyTest < ActionController::TestCase end def test_view_cache_dependencies_are_empty_by_default - assert NoDependenciesController.view_cache_dependencies.empty? + assert NoDependenciesController.new.view_cache_dependencies.empty? end def test_view_cache_dependencies_are_listed_in_declaration_order - assert_equal %w(trombone flute), HasDependenciesController.view_cache_dependencies + assert_equal %w(trombone flute), HasDependenciesController.new.view_cache_dependencies end end -- cgit v1.2.3