From 8a722e09122a2beeb122a8931a08b72c46d6bc50 Mon Sep 17 00:00:00 2001 From: Frederick Cheung Date: Sun, 22 May 2011 19:49:31 +0100 Subject: Take into account time spent in AR even if a redirect occurs or if it is after the render --- activerecord/lib/active_record/railties/controller_runtime.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/railties') diff --git a/activerecord/lib/active_record/railties/controller_runtime.rb b/activerecord/lib/active_record/railties/controller_runtime.rb index fb3fd34665..c5db9b4625 100644 --- a/activerecord/lib/active_record/railties/controller_runtime.rb +++ b/activerecord/lib/active_record/railties/controller_runtime.rb @@ -32,7 +32,9 @@ module ActiveRecord def append_info_to_payload(payload) super - payload[:db_runtime] = db_runtime + if ActiveRecord::Base.connected? + payload[:db_runtime] = (db_runtime || 0) + ActiveRecord::LogSubscriber.reset_runtime + end end module ClassMethods -- cgit v1.2.3