Permalink
Browse files

look up connection once

  • Loading branch information...
1 parent fc088d4 commit 0d0e79398308e6147e59d99a48c7e6d952e5848c @tenderlove tenderlove committed Jul 25, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/lib/active_record/railties/controller_runtime.rb
@@ -11,9 +11,10 @@ module ControllerRuntime
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

0 comments on commit 0d0e793

Please sign in to comment.