instance method
connection
Ruby on Rails 7.0.10
Since v2.2.3 Last seen in v7.2.3Signature
connection()
Retrieve the connection associated with the current thread, or call #checkout to obtain one if necessary.
#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 180
def connection
@thread_cached_conns[connection_cache_key(current_thread)] ||= checkout
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 180
· View on GitHub
· Improve this page
· Find usages on GitHub