class ActiveRecord::DatabaseConfigurations
def resolve(config) # :nodoc:
# => DatabaseConfigurations::UrlConfig.new(config: {"adapter" => "postgresql", "host" => "localhost", "database" => "foo"})
DatabaseConfigurations.new({}).resolve("postgresql://localhost/foo")
Connection URL.
# => DatabaseConfigurations::HashConfig.new(config: {"adapter" => "sqlite3"})
DatabaseConfigurations.new({}).resolve("adapter" => "sqlite3")
One layer deep hash of connection values.
# => DatabaseConfigurations::HashConfig.new(env_name: "production", config: {})
DatabaseConfigurations.new("production" => {}).resolve(:production)
Symbol representing current environment.
== Examples
Always returns a DatabaseConfiguration::DatabaseConfig
Returns fully resolved connection, accepts hash, string or symbol.
def resolve(config) # :nodoc: return config if DatabaseConfigurations::DatabaseConfig === config case config when Symbol resolve_symbol_connection(config) when Hash, String build_db_config_from_raw_config(default_env, "primary", config) else raise TypeError, "Invalid type for configuration. Expected Symbol, String, or Hash. Got #{config.inspect}" end end