diff options
author | Eugene Kenny <elkenny@gmail.com> | 2018-03-31 15:26:46 +0100 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2018-03-31 15:26:46 +0100 |
commit | 726e21e86ef092ebf8199041ba24ba492baca27f (patch) | |
tree | e9e5712112cfb07bcec99248ed4f57ab1340329d /activerecord/lib/active_record/database_configurations.rb | |
parent | f4680e492331ccf205ca6cc77d9cdf12d315deb0 (diff) | |
download | rails-726e21e86ef092ebf8199041ba24ba492baca27f.tar.gz rails-726e21e86ef092ebf8199041ba24ba492baca27f.tar.bz2 rails-726e21e86ef092ebf8199041ba24ba492baca27f.zip |
Fix two-level database configurations with URLs
An entry in `ActiveRecord::Base.configurations` can either be a
connection spec ("two-level") or a hash of specs ("three-level").
We were detecting two-level configurations by looking for the `database`
key, but the database can also be specified as part of the `url` key,
which meant we incorrectly treated those configurations as three-level.
Diffstat (limited to 'activerecord/lib/active_record/database_configurations.rb')
-rw-r--r-- | activerecord/lib/active_record/database_configurations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/database_configurations.rb b/activerecord/lib/active_record/database_configurations.rb index 1c7a5d1347..09aef62753 100644 --- a/activerecord/lib/active_record/database_configurations.rb +++ b/activerecord/lib/active_record/database_configurations.rb @@ -43,7 +43,7 @@ module ActiveRecord # Given an env, spec and config creates DatabaseConfig structs with # each attribute set. def self.walk_configs(env_name, spec_name, config) # :nodoc: - if config["database"] || env_name == "default" + if config["database"] || config["url"] || env_name == "default" DatabaseConfig.new(env_name, spec_name, config) else config.each_pair.map do |sub_spec_name, sub_config| |