From 4211866b7a1d0abf0c9150fd61ea67a8043b831d Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 28 Mar 2011 16:43:34 -0700 Subject: adding active_connection? to the connection pool --- .../active_record/connection_adapters/abstract/connection_pool.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb') 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 4297c26413..61e44d09bf 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -151,6 +151,12 @@ module ActiveRecord @reserved_connections[current_connection_id] ||= checkout end + # Check to see if there is an active connection in this connection + # pool. + def active_connection? + @reserved_connections.key? current_connection_id + end + # Signal that the thread is finished with the current connection. # #release_connection releases the connection-thread association # and returns the connection to the pool. -- cgit v1.2.3