1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Avoid retrieving connection in ActiveRecord::QueryCache multiple times.

This commit is contained in:
Guo Xiang Tan 2014-07-07 11:10:32 +08:00
parent 2f716694f2
commit a93c3847ac

View file

@ -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