instance method
lease_connection
Ruby on Rails 8.1.2
Since v7.2.3Signature
lease_connection()
Retrieve the connection associated with the current thread, or call #checkout to obtain one if necessary.
#lease_connection can be called any number of times; the connection is held in a cache keyed by a thread.
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 355
def lease_connection
lease = connection_lease
lease.connection ||= checkout
lease.sticky = true
lease.connection
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 355
· View on GitHub
· Improve this page
· Find usages on GitHub