instance method
resolve_pool_config
Ruby on Rails 7.2.3
Since v6.1.7.10 PrivateSignature
resolve_pool_config(config, connection_name, role, shard)
Returns an instance of PoolConfig for a given adapter. Accepts a hash one layer deep that contains all connection information.
Example
config = { "production" => { "host" => "localhost", "database" => "foo", "adapter" => "sqlite3" } } pool_config = Base.configurations.resolve_pool_config(:production) pool_config.db_config.configuration_hash # => { host: "localhost", database: "foo", adapter: "sqlite3" }
Parameters
-
configreq -
connection_namereq -
rolereq -
shardreq
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb, line 266
def resolve_pool_config(config, connection_name, role, shard)
db_config = Base.configurations.resolve(config)
db_config.validate!
raise(AdapterNotSpecified, "database configuration does not specify adapter") unless db_config.adapter
ConnectionAdapters::PoolConfig.new(connection_name, db_config, role, shard)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb line 266
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::ConnectionHandler