instance method lease_connection

Ruby on Rails 7.2.3

Since v7.2.3

Available in: v7.2.3 v8.0.4 v8.1.2

Signature

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 317
      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 317 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::ConnectionPool

Type at least 2 characters to search.

↑↓ navigate · open · esc close