Skip to content
This repository
Browse code

Merge pull request #8821 from jamis/master

Evaluate view_cache_dependencies at the instance level

Conflicts:
	actionpack/lib/action_controller/caching.rb
  • Loading branch information...
commit 2b5019e234b89a201e11ade6e280f3fc0e64f577 2 parents 8d926f5 + 0121377
Rafael Mendonça França authored January 10, 2013
6  actionpack/lib/action_controller/caching.rb
@@ -80,10 +80,6 @@ module ClassMethods
80 80
       def view_cache_dependency(&dependency)
81 81
         self._view_cache_dependencies += [dependency]
82 82
       end
83  
-
84  
-      def view_cache_dependencies
85  
-        _view_cache_dependencies.map { |dep| instance_exec(&dep) }.compact
86  
-      end
87 83
     end
88 84
 
89 85
     def caching_allowed?
@@ -91,7 +87,7 @@ def caching_allowed?
91 87
     end
92 88
 
93 89
     def view_cache_dependencies
94  
-      self.class.view_cache_dependencies
  90
+      self.class._view_cache_dependencies.map { |dep| instance_exec(&dep) }.compact
95 91
     end
96 92
 
97 93
     protected
4  actionpack/test/controller/caching_test.rb
@@ -306,11 +306,11 @@ class HasDependenciesController < ActionController::Base
306 306
   end
307 307
 
308 308
   def test_view_cache_dependencies_are_empty_by_default
309  
-    assert NoDependenciesController.view_cache_dependencies.empty?
  309
+    assert NoDependenciesController.new.view_cache_dependencies.empty?
310 310
   end
311 311
 
312 312
   def test_view_cache_dependencies_are_listed_in_declaration_order
313  
-    assert_equal %w(trombone flute), HasDependenciesController.view_cache_dependencies
  313
+    assert_equal %w(trombone flute), HasDependenciesController.new.view_cache_dependencies
314 314
   end
315 315
 end
316 316
 

0 notes on commit 2b5019e

Please sign in to comment.
Something went wrong with that request. Please try again.