Skip to content
This repository
Browse code

Don't wrap the raise with ensure

  • Loading branch information...
commit f92c81213c775250b4063a5f1cd5da3e3922cbc4 1 parent d70ed10
Santiago Pastorino spastorino authored
20 actionpack/lib/action_view/template.rb
@@ -160,16 +160,18 @@ def mime_type
160 160 # virtual path set (true just for inline templates).
161 161 def refresh(view)
162 162 raise "A template needs to have a virtual path in order to be refreshed" unless @virtual_path
163   - lookup = view.lookup_context
164   - pieces = @virtual_path.split("/")
165   - name = pieces.pop
166   - partial = !!name.sub!(/^_/, "")
167   - previous_formats, lookup.formats = lookup.formats, @formats
168   - lookup.disable_cache do
169   - lookup.find_template(name, [ pieces.join('/') ], partial, @locals)
  163 + begin
  164 + lookup = view.lookup_context
  165 + pieces = @virtual_path.split("/")
  166 + name = pieces.pop
  167 + partial = !!name.sub!(/^_/, "")
  168 + previous_formats, lookup.formats = lookup.formats, @formats
  169 + lookup.disable_cache do
  170 + lookup.find_template(name, [ pieces.join('/') ], partial, @locals)
  171 + end
  172 + ensure
  173 + lookup.formats = previous_formats
170 174 end
171   - ensure
172   - lookup.formats = previous_formats
173 175 end
174 176
175 177 def inspect
2  actionpack/test/template/template_test.rb
@@ -12,7 +12,7 @@ def disable_cache
12 12 def find_template(*args)
13 13 end
14 14
15   - attr_writer :formats
  15 + attr_accessor :formats
16 16 end
17 17
18 18 class Context

0 comments on commit f92c812

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