diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-02-21 15:57:24 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-02-21 15:58:08 -0200 |
commit | d37a7e629834c5a83eef38cb09ba12433d30c802 (patch) | |
tree | d86cbeeef0b727c1fe472ca0f203fabc1955eff5 | |
parent | 12e2405a276e783791c34432272f22ad3517a140 (diff) | |
download | rails-d37a7e629834c5a83eef38cb09ba12433d30c802.tar.gz rails-d37a7e629834c5a83eef38cb09ba12433d30c802.tar.bz2 rails-d37a7e629834c5a83eef38cb09ba12433d30c802.zip |
Don't wrap the raise with ensure
-rw-r--r-- | actionpack/lib/action_view/template.rb | 20 | ||||
-rw-r--r-- | actionpack/test/template/template_test.rb | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb index 630625fb90..f64cecaf20 100644 --- a/actionpack/lib/action_view/template.rb +++ b/actionpack/lib/action_view/template.rb @@ -159,16 +159,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 diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb index 63f1d3a6c0..8c57ada587 100644 --- a/actionpack/test/template/template_test.rb +++ b/actionpack/test/template/template_test.rb @@ -12,7 +12,7 @@ class TestERBTemplate < ActiveSupport::TestCase def find_template(*args) end - attr_writer :formats + attr_accessor :formats end class Context |