diff options
author | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-07-07 11:10:32 +0800 |
---|---|---|
committer | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-07-07 11:10:32 +0800 |
commit | a93c3847aceed04e67f962a32711b8c357389f17 (patch) | |
tree | 862600911002d2e468a1fc53e804e536c402b32f /activerecord | |
parent | 2f716694f20cd19464029513fb59440fd9000840 (diff) | |
download | rails-a93c3847aceed04e67f962a32711b8c357389f17.tar.gz rails-a93c3847aceed04e67f962a32711b8c357389f17.tar.bz2 rails-a93c3847aceed04e67f962a32711b8c357389f17.zip |
Avoid retrieving connection in ActiveRecord::QueryCache multiple times.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/query_cache.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index df8654e5c1..16ad942912 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -29,9 +29,10 @@ module ActiveRecord end def call(env) - enabled = ActiveRecord::Base.connection.query_cache_enabled + connection = ActiveRecord::Base.connection + enabled = connection.query_cache_enabled connection_id = ActiveRecord::Base.connection_id - ActiveRecord::Base.connection.enable_query_cache! + connection.enable_query_cache! response = @app.call(env) response[2] = Rack::BodyProxy.new(response[2]) do |