instance method
connection
Ruby on Rails 2.2.3
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 hash keyed by the thread id.
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 94
def connection
if conn = @reserved_connections[current_connection_id]
conn
else
@reserved_connections[current_connection_id] = checkout
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 94
· View on GitHub
· Improve this page
· Find usages on GitHub