Don't wrap the raise with ensure

This commit is contained in:
Santiago Pastorino
2012-02-21 15:57:24 -02:00
parent d70ed102c8
commit f92c81213c
2 changed files with 12 additions and 10 deletions

View File

@@ -160,16 +160,18 @@ module ActionView
# 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 File

@@ -12,7 +12,7 @@ class TestERBTemplate < ActiveSupport::TestCase
def find_template(*args)
end
attr_writer :formats
attr_accessor :formats
end
class Context