diff options
author | Frederick Cheung <frederick.cheung@gmail.com> | 2011-05-22 19:49:31 +0100 |
---|---|---|
committer | Frederick Cheung <frederick.cheung@gmail.com> | 2011-05-23 10:58:43 +0100 |
commit | 8a722e09122a2beeb122a8931a08b72c46d6bc50 (patch) | |
tree | e4727ae2767c960d92584a353ad4962ebe9b4f22 /activerecord/lib/active_record/railties | |
parent | 4ee7d923e1962bec68d56c565d574672dce5b692 (diff) | |
download | rails-8a722e09122a2beeb122a8931a08b72c46d6bc50.tar.gz rails-8a722e09122a2beeb122a8931a08b72c46d6bc50.tar.bz2 rails-8a722e09122a2beeb122a8931a08b72c46d6bc50.zip |
Take into account time spent in AR even if a redirect occurs or if it is after the render
Diffstat (limited to 'activerecord/lib/active_record/railties')
-rw-r--r-- | activerecord/lib/active_record/railties/controller_runtime.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 |