instance method
establish_connection
Ruby on Rails 6.0.6
Since v2.2.3Signature
establish_connection(config)
No documentation comment.
Parameters
-
configreq
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 1056
def establish_connection(config)
resolver = ConnectionSpecification::Resolver.new(Base.configurations)
spec = resolver.spec(config)
remove_connection(spec.name)
message_bus = ActiveSupport::Notifications.instrumenter
payload = {
connection_id: object_id
}
if spec
payload[:spec_name] = spec.name
payload[:config] = spec.config
end
message_bus.instrument("!connection.active_record", payload) do
owner_to_pool[spec.name] = ConnectionAdapters::ConnectionPool.new(spec)
end
owner_to_pool[spec.name]
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 1056
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::ConnectionHandler