diff options
author | Justin George <justin.george@gmail.com> | 2010-04-27 21:16:06 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-02 22:45:54 +0200 |
commit | 731d4392e478ff5526b595074d9caa999da8bd0c (patch) | |
tree | d44fc64ddc208880501ef00f3f916d04d8e28141 /actionpack/lib/action_controller | |
parent | 109d3ee38d1c39f0e27bc827065427635d6396b2 (diff) | |
download | rails-731d4392e478ff5526b595074d9caa999da8bd0c.tar.gz rails-731d4392e478ff5526b595074d9caa999da8bd0c.tar.bz2 rails-731d4392e478ff5526b595074d9caa999da8bd0c.zip |
Change event namespace ordering to most-significant first [#4504 state:resolved]
More work still needs to be done on some of these names
(render_template.action_view and render_template!.action_view particularly)
but this allows (for example) /^sql/ to subscribe to all
the various ORMs without further modification
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/lib/action_controller')
4 files changed, 11 insertions, 11 deletions
diff --git a/actionpack/lib/action_controller/caching/fragments.rb b/actionpack/lib/action_controller/caching/fragments.rb index 473a2fe214..460273dac1 100644 --- a/actionpack/lib/action_controller/caching/fragments.rb +++ b/actionpack/lib/action_controller/caching/fragments.rb @@ -99,7 +99,7 @@ module ActionController #:nodoc: end def instrument_fragment_cache(name, key) - ActiveSupport::Notifications.instrument("action_controller.#{name}", :key => key){ yield } + ActiveSupport::Notifications.instrument("#{name}.action_controller", :key => key){ yield } end end end diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb index cefd1f48c0..4f7a5d3f55 100644 --- a/actionpack/lib/action_controller/caching/pages.rb +++ b/actionpack/lib/action_controller/caching/pages.rb @@ -109,7 +109,7 @@ module ActionController #:nodoc: end def instrument_page_cache(name, path) - ActiveSupport::Notifications.instrument("action_controller.#{name}", :path => path){ yield } + ActiveSupport::Notifications.instrument("#{name}.action_controller", :path => path){ yield } end end diff --git a/actionpack/lib/action_controller/metal/instrumentation.rb b/actionpack/lib/action_controller/metal/instrumentation.rb index d69de65f28..ba38b186d6 100644 --- a/actionpack/lib/action_controller/metal/instrumentation.rb +++ b/actionpack/lib/action_controller/metal/instrumentation.rb @@ -23,9 +23,9 @@ module ActionController :path => (request.fullpath rescue "unknown") } - ActiveSupport::Notifications.instrument("action_controller.start_processing", raw_payload.dup) + ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup) - ActiveSupport::Notifications.instrument("action_controller.process_action", raw_payload) do |payload| + ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload| result = super payload[:status] = response.status append_info_to_payload(payload) @@ -42,20 +42,20 @@ module ActionController end def send_file(path, options={}) - ActiveSupport::Notifications.instrument("action_controller.send_file", + ActiveSupport::Notifications.instrument("send_file.action_controller", options.merge(:path => path)) do super end end def send_data(data, options = {}) - ActiveSupport::Notifications.instrument("action_controller.send_data", options) do + ActiveSupport::Notifications.instrument("send_data.action_controller", options) do super end end def redirect_to(*args) - ActiveSupport::Notifications.instrument("action_controller.redirect_to") do |payload| + ActiveSupport::Notifications.instrument("redirect_to.action_controller") do |payload| result = super payload[:status] = self.status payload[:location] = self.location diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 2b9b34961e..2010d8573c 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -16,12 +16,12 @@ module ActionController @templates = Hash.new(0) @layouts = Hash.new(0) - ActiveSupport::Notifications.subscribe("action_view.render_template") do |name, start, finish, id, payload| + ActiveSupport::Notifications.subscribe("render_template.action_view") do |name, start, finish, id, payload| path = payload[:layout] @layouts[path] += 1 end - ActiveSupport::Notifications.subscribe("action_view.render_template!") do |name, start, finish, id, payload| + ActiveSupport::Notifications.subscribe("!render_template.action_view") do |name, start, finish, id, payload| path = payload[:virtual_path] next unless path partial = path =~ /^.*\/_[^\/]*$/ @@ -36,8 +36,8 @@ module ActionController end def teardown_subscriptions - ActiveSupport::Notifications.unsubscribe("action_view.render_template") - ActiveSupport::Notifications.unsubscribe("action_view.render_template!") + ActiveSupport::Notifications.unsubscribe("render_template.action_view") + ActiveSupport::Notifications.unsubscribe("!render_template.action_view") end # Asserts that the request was rendered with the appropriate template file or partials |