Method: ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver#resolve
- Defined in:
- lib/active_record/connection_adapters/connection_specification.rb
#resolve(config) ⇒ Object
Returns a hash with database connection information.
Examples
Full hash Configuration.
configurations = { "production" => { "host" => "localhost", "database" => "foo", "adapter" => "sqlite3" } }
Resolver.new(configurations).resolve(:production)
# => { "host" => "localhost", "database" => "foo", "adapter" => "sqlite3"}
Initialized with URL configuration strings.
configurations = { "production" => "postgresql://localhost/foo" }
Resolver.new(configurations).resolve(:production)
# => { "host" => "localhost", "database" => "foo", "adapter" => "postgresql" }
141 142 143 144 145 146 147 148 149 |
# File 'lib/active_record/connection_adapters/connection_specification.rb', line 141 def resolve(config) if config resolve_connection config elsif env = ActiveRecord::ConnectionHandling::RAILS_ENV.call resolve_symbol_connection env.to_sym else raise AdapterNotSpecified end end |