database_connection_helpers.rb 200 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
module DatabaseConnectionHelpers
  def run_with_new_database_connection
    pool = ActiveRecord::Base.connection_pool
    conn = pool.checkout
    yield conn
  ensure
    pool.checkin(conn)
  end
end