2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module DatabaseConnectionHelpers
|
|
|
|
def run_with_new_database_connection
|
|
|
|
pool = ActiveRecord::Base.connection_pool
|
|
|
|
conn = pool.checkout
|
|
|
|
yield conn
|
|
|
|
ensure
|
|
|
|
pool.checkin(conn)
|
|
|
|
end
|
|
|
|
end
|