aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/render
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/render')
-rw-r--r--actionpack/lib/action_view/render/partials.rb17
-rw-r--r--actionpack/lib/action_view/render/rendering.rb24
2 files changed, 19 insertions, 22 deletions
diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb
index 5158415c20..8c936ae09e 100644
--- a/actionpack/lib/action_view/render/partials.rb
+++ b/actionpack/lib/action_view/render/partials.rb
@@ -212,34 +212,34 @@ module ActionView
end
def render
- options = @options
+ identifier = ((@template = find_template) ? @template.identifier : @path)
if @collection
- ActiveSupport::Notifications.instrument(:render_collection, :path => @path,
- :count => @collection.size) do
+ ActiveSupport::Notifications.instrument("action_view.render_collection",
+ :identifier => identifier || "collection", :count => @collection.size) do
render_collection
end
else
- content = ActiveSupport::Notifications.instrument(:render_partial, :path => @path) do
+ content = ActiveSupport::Notifications.instrument("action_view.render_partial",
+ :identifier => identifier) do
render_partial
end
- if !@block && options[:layout]
- content = @view._render_layout(find_template(options[:layout]), @locals){ content }
+ if !@block && (layout = @options[:layout])
+ content = @view._render_layout(find_template(layout), @locals){ content }
end
content
end
end
def render_collection
- @template = template = find_template
return nil if @collection.blank?
if @options.key?(:spacer_template)
spacer = find_template(@options[:spacer_template]).render(@view, @locals)
end
- result = template ? collection_with_template : collection_without_template
+ result = @template ? collection_with_template : collection_without_template
result.join(spacer).html_safe!
end
@@ -277,7 +277,6 @@ module ActionView
end
def render_partial(object = @object)
- @template = template = find_template
locals, view = @locals, @view
object ||= locals[template.variable_name]
diff --git a/actionpack/lib/action_view/render/rendering.rb b/actionpack/lib/action_view/render/rendering.rb
index 48316cac53..ec278ca783 100644
--- a/actionpack/lib/action_view/render/rendering.rb
+++ b/actionpack/lib/action_view/render/rendering.rb
@@ -93,25 +93,23 @@ module ActionView
def _render_template(template, layout = nil, options = {})
locals = options[:locals] || {}
- content = ActiveSupport::Notifications.instrument(:render_template,
- :identifier => template.identifier, :layout => (layout ? layout.identifier : nil)) do
- template.render(self, locals)
- end
+ ActiveSupport::Notifications.instrument("action_view.render_template",
+ :identifier => template.identifier, :layout => layout.try(:identifier)) do
- @_content_for[:layout] = content
+ content = template.render(self, locals)
+ @_content_for[:layout] = content
- if layout
- @_layout = layout.identifier
- content = _render_layout(layout, locals)
- end
+ if layout
+ @_layout = layout.identifier
+ content = _render_layout(layout, locals)
+ end
- content
+ content
+ end
end
def _render_layout(layout, locals, &block)
- ActiveSupport::Notifications.instrument(:render_layout, :identifier => layout.identifier) do
- layout.render(self, locals){ |*name| _layout_for(*name, &block) }
- end
+ layout.render(self, locals){ |*name| _layout_for(*name, &block) }
end
end
end