aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikac.hu>2016-02-26 13:23:59 -0500
committerPrem Sichanugrist <s@sikac.hu>2016-02-26 13:23:59 -0500
commitb84ca28a21dbf75a4058d4835eb4bf9220de6de7 (patch)
tree83a0211d7fd441d45c1bbff63e7132e6c48d32e9
parentc8915ec335887e07a967f2688d30c800b80ee256 (diff)
downloadrails-b84ca28a21dbf75a4058d4835eb4bf9220de6de7.tar.gz
rails-b84ca28a21dbf75a4058d4835eb4bf9220de6de7.tar.bz2
rails-b84ca28a21dbf75a4058d4835eb4bf9220de6de7.zip
Update to use Subscriber#start instead
We don't need to instrument another event as `ActiveSupport::LogSubscriber` already tracks when the instrumentation starts. Close #23717
-rw-r--r--actionview/lib/action_view/log_subscriber.rb21
-rw-r--r--actionview/lib/action_view/renderer/template_renderer.rb1
2 files changed, 15 insertions, 7 deletions
diff --git a/actionview/lib/action_view/log_subscriber.rb b/actionview/lib/action_view/log_subscriber.rb
index 2d59033cb3..5a29c68214 100644
--- a/actionview/lib/action_view/log_subscriber.rb
+++ b/actionview/lib/action_view/log_subscriber.rb
@@ -30,13 +30,12 @@ module ActionView
end
end
-
- def start_rendering(event)
- info do
- message = "Rendering #{from_rails_root(event.payload[:identifier])}"
- message << " within #{from_rails_root(event.payload[:layout])}" if event.payload[:layout]
- message
+ def start(name, id, payload)
+ if name == "render_template.action_view"
+ log_rendering_start(payload)
end
+
+ super
end
def logger
@@ -63,6 +62,16 @@ module ActionView
"[#{payload[:count]} times]"
end
end
+
+ private
+
+ def log_rendering_start(payload)
+ info do
+ message = " Rendering #{from_rails_root(payload[:identifier])}"
+ message << " within #{from_rails_root(payload[:layout])}" if payload[:layout]
+ message
+ end
+ end
end
end
diff --git a/actionview/lib/action_view/renderer/template_renderer.rb b/actionview/lib/action_view/renderer/template_renderer.rb
index fd550d95e1..9d15bbfca7 100644
--- a/actionview/lib/action_view/renderer/template_renderer.rb
+++ b/actionview/lib/action_view/renderer/template_renderer.rb
@@ -50,7 +50,6 @@ module ActionView
view, locals = @view, locals || {}
render_with_layout(layout_name, locals) do |layout|
- ActiveSupport::Notifications.instrument("start_rendering.action_view", identifier: template.identifier, layout: layout.try(:virtual_path))
instrument(:template, :identifier => template.identifier, :layout => layout.try(:virtual_path)) do
template.render(view, locals) { |*name| view._layout_for(*name) }
end