From e5a2a9fced3e5559ac139977922a0f63a53c6c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 15 Jan 2010 14:45:18 +0100 Subject: Remove URI object from ActiveResource notification, send the :mailer class in AM (like in AP#process_action) and remove locale instrumentation. --- activeresource/lib/active_resource/connection.rb | 7 ++++--- activeresource/lib/active_resource/railties/subscriber.rb | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'activeresource') diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index d06543d700..2f0ccd7dae 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -106,9 +106,10 @@ module ActiveResource private # Makes a request to the remote service. def request(method, path, *arguments) - result = ActiveSupport::Notifications.instrument("active_resource.request", - :method => method, :path => path, :site => site) do |payload| - payload[:result] = http.send(method, path, *arguments) + result = ActiveSupport::Notifications.instrument("active_resource.request") do |payload| + payload[:method] = method + payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}" + payload[:result] = http.send(method, path, *arguments) end handle_response(result) rescue Timeout::Error => e diff --git a/activeresource/lib/active_resource/railties/subscriber.rb b/activeresource/lib/active_resource/railties/subscriber.rb index 42c108d702..fb98061b71 100644 --- a/activeresource/lib/active_resource/railties/subscriber.rb +++ b/activeresource/lib/active_resource/railties/subscriber.rb @@ -2,8 +2,8 @@ module ActiveResource module Railties class Subscriber < Rails::Subscriber def request(event) - result, site = event.payload[:result], event.payload[:site] - info "#{event.payload[:method].to_s.upcase} #{site.scheme}://#{site.host}:#{site.port}#{event.payload[:path]}" + result = event.payload[:result] + info "#{event.payload[:method].to_s.upcase} #{event.payload[:request_uri]}" info "--> %d %s %d (%.1fms)" % [result.code, result.message, result.body.to_s.length, event.duration] end -- cgit v1.2.3