instance method
lease_connection
Ruby on Rails 7.2.3
Since v7.2.3Signature
lease_connection()
Returns the connection currently associated with the class. This can also be used to “borrow” the connection to do database work unrelated to any of the specific Active Records. The connection will remain leased for the entire duration of the request or job, or until #release_connection is called.
Source
# File activerecord/lib/active_record/connection_handling.rb, line 257
def lease_connection
connection_pool.lease_connection
end
Defined in activerecord/lib/active_record/connection_handling.rb line 257
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionHandling