instance method
lease_connection
Ruby on Rails edge
Since v7.2.3.2Signature
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 295
def lease_connection
connection_pool.lease_connection
end
Defined in activerecord/lib/active_record/connection_handling.rb line 295
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionHandling