aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2012-02-21 15:57:24 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2012-02-21 15:58:25 -0200
commitf92c81213c775250b4063a5f1cd5da3e3922cbc4 (patch)
tree96cbda77c58fbd8723db5c6ac508aced064e1b4e
parentd70ed102c881c5b7404f2bf43aa0e268ade1b991 (diff)
downloadrails-f92c81213c775250b4063a5f1cd5da3e3922cbc4.tar.gz
rails-f92c81213c775250b4063a5f1cd5da3e3922cbc4.tar.bz2
rails-f92c81213c775250b4063a5f1cd5da3e3922cbc4.zip
Don't wrap the raise with ensure
-rw-r--r--actionpack/lib/action_view/template.rb20
-rw-r--r--actionpack/test/template/template_test.rb2
2 files changed, 12 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 3a944cf1ab..ebb8e5c1a6 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -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
diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb
index 836c5c7586..dd45a08b01 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