2019-07-25 01:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-17 08:53:42 -05:00
|
|
|
module DatabaseConnectionHelpers
|
|
|
|
def run_with_new_database_connection
|
|
|
|
pool = ActiveRecord::Base.connection_pool
|
|
|
|
conn = pool.checkout
|
|
|
|
yield conn
|
|
|
|
ensure
|
|
|
|
pool.checkin(conn)
|
|
|
|
end
|
|
|
|
end
|