aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers
diff options
context:
space:
mode:
authorStan Lo <a22301613@yahoo.com.tw>2017-04-02 00:24:03 +0800
committerKasper Timm Hansen <kaspth@gmail.com>2017-06-08 21:42:46 +0200
commit2abf6ca0c8304a3cfcdae6e14060b561780be43c (patch)
tree189b1f287e37b3c79ad2056ca659e8733fe88491 /actionview/lib/action_view/helpers
parentf1e42fe267342ffa4cea84cf09b0caaee733632c (diff)
downloadrails-2abf6ca0c8304a3cfcdae6e14060b561780be43c.tar.gz
rails-2abf6ca0c8304a3cfcdae6e14060b561780be43c.tar.bz2
rails-2abf6ca0c8304a3cfcdae6e14060b561780be43c.zip
Use a hash to record every partial's cache hit status instead of sharing a boolean.
Diffstat (limited to 'actionview/lib/action_view/helpers')
-rw-r--r--actionview/lib/action_view/helpers/cache_helper.rb6
1 files changed, 4 insertions, 2 deletions
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