instance method
with_connection
Ruby on Rails 4.0.13
Since v2.2.3Signature
with_connection()
If a connection already exists yield it to the block. If no connection exists checkout a connection, yield it to the block, and checkin the connection when finished.
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 291
def with_connection
connection_id = current_connection_id
fresh_connection = true unless active_connection?
yield connection
ensure
release_connection(connection_id) if fresh_connection
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 291
· View on GitHub
· Improve this page
· Find usages on GitHub