diff options
author | Kevin Buchanan <kevaustinbuch@gmail.com> | 2015-10-15 14:25:47 -0500 |
---|---|---|
committer | Kevin Buchanan <kevaustinbuch@gmail.com> | 2015-11-06 16:14:24 -0600 |
commit | 2fe4586974689842dbdf3354678438618089accc (patch) | |
tree | dbef2dfcf006ecadf748de995c23dba857ac9d33 /activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
parent | 79d310fbd33c172f7f54d989191008581e028b64 (diff) | |
download | rails-2fe4586974689842dbdf3354678438618089accc.tar.gz rails-2fe4586974689842dbdf3354678438618089accc.tar.bz2 rails-2fe4586974689842dbdf3354678438618089accc.zip |
Avoids mutating the original response in connection management middleware
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 758eedc37d..486b7b6d25 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -960,12 +960,11 @@ module ActiveRecord def call(env) testing = env['rack.test'] - response = @app.call(env) - response[2] = ::Rack::BodyProxy.new(response[2]) do + status, headers, body = @app.call(env) + proxy = ::Rack::BodyProxy.new(body) do ActiveRecord::Base.clear_active_connections! unless testing end - - response + [status, headers, proxy] rescue Exception ActiveRecord::Base.clear_active_connections! unless testing raise |