aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-25 11:16:13 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-25 11:16:13 -0700
commit0d0e79398308e6147e59d99a48c7e6d952e5848c (patch)
tree6bbaeb2c8c0709efcba2c5e11f2b0cbe08f663f6 /activerecord
parentfc088d4e8fdc7fcc710df094ce4ae6faa27d8c8d (diff)
downloadrails-0d0e79398308e6147e59d99a48c7e6d952e5848c.tar.gz
rails-0d0e79398308e6147e59d99a48c7e6d952e5848c.tar.bz2
rails-0d0e79398308e6147e59d99a48c7e6d952e5848c.zip
look up connection once
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/railties/controller_runtime.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/railties/controller_runtime.rb b/activerecord/lib/active_record/railties/controller_runtime.rb
index aed1c59b00..cf74fa1655 100644
--- a/activerecord/lib/active_record/railties/controller_runtime.rb
+++ b/activerecord/lib/active_record/railties/controller_runtime.rb
@@ -11,9 +11,10 @@ module ActiveRecord
def cleanup_view_runtime
if ActiveRecord::Base.connected?
- db_rt_before_render = ActiveRecord::Base.connection.reset_runtime
+ connection = ActiveRecord::Base.connection
+ db_rt_before_render = connection.reset_runtime
runtime = super
- db_rt_after_render = ActiveRecord::Base.connection.reset_runtime
+ db_rt_after_render = connection.reset_runtime
self.db_runtime = db_rt_before_render + db_rt_after_render
runtime - db_rt_after_render
else