diff options
author | Josh Lauer <jlauer@cloudspace.com> | 2013-08-05 16:36:47 -0400 |
---|---|---|
committer | Josh Lauer <jlauer@cloudspace.com> | 2013-08-06 14:06:42 -0400 |
commit | 7e74a01f849db3b85ac04ce425461c22b2b191d3 (patch) | |
tree | 6be26ece2a93698980b5dfe8f7fdb7878dc55fc4 /actionview/lib | |
parent | 9b6a434defe7aed00f01643abdbc79751dc9d5f1 (diff) | |
download | rails-7e74a01f849db3b85ac04ce425461c22b2b191d3.tar.gz rails-7e74a01f849db3b85ac04ce425461c22b2b191d3.tar.bz2 rails-7e74a01f849db3b85ac04ce425461c22b2b191d3.zip |
Only cache template digests if config.cache_template_loading
since ActionView::Resolver.caching is set to the same value as config.cache_template_loading
only cache template digests if config.cache_template_loading is not falsy
fixes issues #10752 and #10791
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/digestor.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index 64239c81b2..95c3200c81 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -32,9 +32,13 @@ module ActionView Digestor end - @@cache[cache_key] = digest = klass.new(name, format, finder, options).digest # Store the actual digest - ensure - @@cache.delete_pair(cache_key, false) if pre_stored && !digest # something went wrong, make sure not to corrupt the @@cache + # Store the actual digest if config.cache_template_loading is true + klass.new(name, format, finder, options).digest.tap do |digest| + @@cache[cache_key] = digest if ActionView::Resolver.caching? + end + rescue Exception + @@cache.delete_pair(cache_key, false) if pre_stored # something went wrong, make sure not to corrupt the @@cache + raise end end |