Merge pull request #8821 from jamis/master

Evaluate view_cache_dependencies at the instance level

Conflicts:
	actionpack/lib/action_controller/caching.rb
This commit is contained in:
Rafael Mendonça França 2013-01-10 13:34:40 -02:00
commit 2b5019e234
2 changed files with 3 additions and 7 deletions

View File

@ -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

View File

@ -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