class ActiveRecord::ConnectionAdapters::ConnectionPool
def with_connection
exists checkout a connection, yield it to the block, and checkin the
already exists yield it to the block. If no such connection
If a connection obtained through #connection or #with_connection methods
def with_connection unless conn = @thread_cached_conns[connection_cache_key(Thread.current)] conn = connection fresh_connection = true end yield conn ensure release_connection if fresh_connection end