aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/template.rb')
-rw-r--r--actionpack/lib/action_view/template.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 6dfc4f68ae..98ecd15aa0 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -139,15 +139,12 @@ module ActionView
# we use a bang in this instrumentation because you don't want to
# consume this in production. This is only slow if it's being listened to.
def render(view, locals, buffer=nil, &block)
- old_template, view._template = view._template, self
ActiveSupport::Notifications.instrument("!render_template.action_view", :virtual_path => @virtual_path) do
compile!(view)
view.send(method_name, locals, buffer, &block)
end
rescue Exception => e
handle_render_error(view, e)
- ensure
- view._template = old_template
end
def mime_type
@@ -174,12 +171,7 @@ module ActionView
end
def inspect
- @inspect ||=
- if defined?(Rails.root)
- identifier.sub("#{Rails.root}/", '')
- else
- identifier
- end
+ @inspect ||= defined?(Rails.root) ? identifier.sub("#{Rails.root}/", '') : identifier
end
protected
@@ -264,9 +256,9 @@ module ActionView
# encoding of the code
source = <<-end_src
def #{method_name}(local_assigns, output_buffer)
- _old_output_buffer = @output_buffer;#{locals_code};#{code}
+ _old_virtual_path, @virtual_path = @virtual_path, #{@virtual_path.inspect};_old_output_buffer = @output_buffer;#{locals_code};#{code}
ensure
- @output_buffer = _old_output_buffer
+ @virtual_path, @output_buffer = _old_virtual_path, _old_output_buffer
end
end_src