class ActiveRecord::ConnectionAdapters::ConnectionPool

def with_connection

connection when finished.
exists checkout a connection, yield it to the block, and checkin the
If a connection already exists yield it to the block. If no connection
def with_connection
  connection_id = current_connection_id
  fresh_connection = true unless active_connection?
  yield connection
ensure
  release_connection(connection_id) if fresh_connection
end