Skip to content
Browse files

Don't wrap the raise with ensure

  • Loading branch information...
1 parent d70ed10 commit f92c81213c775250b4063a5f1cd5da3e3922cbc4 @spastorino spastorino committed Feb 21, 2012
Showing with 12 additions and 10 deletions.
  1. +11 −9 actionpack/lib/action_view/template.rb
  2. +1 −1 actionpack/test/template/template_test.rb
View
20 actionpack/lib/action_view/template.rb
@@ -160,16 +160,18 @@ def mime_type
# virtual path set (true just for inline templates).
def refresh(view)
raise "A template needs to have a virtual path in order to be refreshed" unless @virtual_path
- lookup = view.lookup_context
- pieces = @virtual_path.split("/")
- name = pieces.pop
- partial = !!name.sub!(/^_/, "")
- previous_formats, lookup.formats = lookup.formats, @formats
- lookup.disable_cache do
- lookup.find_template(name, [ pieces.join('/') ], partial, @locals)
+ begin
+ lookup = view.lookup_context
+ pieces = @virtual_path.split("/")
+ name = pieces.pop
+ partial = !!name.sub!(/^_/, "")
+ previous_formats, lookup.formats = lookup.formats, @formats
+ lookup.disable_cache do
+ lookup.find_template(name, [ pieces.join('/') ], partial, @locals)
+ end
+ ensure
+ lookup.formats = previous_formats
end
- ensure
- lookup.formats = previous_formats
end
def inspect
View
2 actionpack/test/template/template_test.rb
@@ -12,7 +12,7 @@ def disable_cache
def find_template(*args)
end
- attr_writer :formats
+ attr_accessor :formats
end
class Context

0 comments on commit f92c812

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