Skip to content
Browse files

Ensure ActionView::Digest.cache is correctly cleaned up when

ActionView::Resolver.caching = false.
  • Loading branch information...
1 parent 89969dd commit 2b3a349123b3f09627bd3f4091e5b885ded0fbac @wyaeld wyaeld committed Oct 15, 2013
Showing with 6 additions and 6 deletions.
  1. +6 −6 actionview/lib/action_view/digestor.rb
View
12 actionview/lib/action_view/digestor.rb
@@ -36,12 +36,12 @@ def compute_and_store_digest(cache_key, name, format, finder, options) # called
end
# 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
+ digest = klass.new(name, format, finder, options).digest
+ @@cache[cache_key] = digest if ActionView::Resolver.caching?
+ digest
+ ensure
+ # something went wrong or ActionView::Resolver.caching? is false, make sure not to corrupt the @@cache
+ @@cache.delete_pair(cache_key, false) if pre_stored || !digest
end
end

0 comments on commit 2b3a349

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