From 2abf6ca0c8304a3cfcdae6e14060b561780be43c Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sun, 2 Apr 2017 00:24:03 +0800 Subject: Use a hash to record every partial's cache hit status instead of sharing a boolean. --- actionview/lib/action_view/helpers/cache_helper.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actionview/lib/action_view/helpers/cache_helper.rb') diff --git a/actionview/lib/action_view/helpers/cache_helper.rb b/actionview/lib/action_view/helpers/cache_helper.rb index c3aecadcd6..dfa0956fe2 100644 --- a/actionview/lib/action_view/helpers/cache_helper.rb +++ b/actionview/lib/action_view/helpers/cache_helper.rb @@ -235,11 +235,13 @@ module ActionView end def fragment_for(name = {}, options = nil, &block) + # Some tests might using this helper without initialize actionview object + @cache_hit ||= {} if content = read_fragment_for(name, options) - @cache_hit = true + @cache_hit[@virtual_path] = true content else - @cache_hit = false + @cache_hit[@virtual_path] = false write_fragment_for(name, options, &block) end end -- cgit v1.2.3