From 3b2a032677a2261499aa5d2de019f31f1173a858 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 29 Mar 2011 15:42:32 -0700 Subject: clearing active connections in the ConnectionManagement middleware if an exception happens --- .../lib/active_record/connection_adapters/abstract/connection_pool.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib') 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 5e12f80263..45900d27dc 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -446,6 +446,9 @@ module ActiveRecord status, headers, body = @app.call(env) [status, headers, Proxy.new(body, env.key?('rack.test'))] + rescue + ActiveRecord::Base.clear_active_connections! + raise end end end -- cgit v1.2.3