diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-03-16 15:18:26 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-16 15:18:26 -0400 |
commit | 9700dacffe412ea47b00db62c0a0099b69b4dfca (patch) | |
tree | b267549a4fb8bce506a02d4450e5f31a8d876fdf /activerecord/lib | |
parent | 45ddb7f1f94c2086488aaaac47a1092cf832f381 (diff) | |
parent | 4027643f7f7eed9186d158fe5b1f21d0d6de8fe1 (diff) | |
download | rails-9700dacffe412ea47b00db62c0a0099b69b4dfca.tar.gz rails-9700dacffe412ea47b00db62c0a0099b69b4dfca.tar.bz2 rails-9700dacffe412ea47b00db62c0a0099b69b4dfca.zip |
Merge pull request #32271 from eileencodes/fix-three-tier-default-connection
Fix default connection handling with three-tier config
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/connection_specification.rb | 1 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_handling.rb | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb index 508132accb..901717ae3d 100644 --- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb @@ -156,7 +156,6 @@ module ActiveRecord env_config = config[env] if config[env].is_a?(Hash) && !(config[env].key?("adapter") || config[env].key?("url")) end - config.reject! { |k, v| v.is_a?(Hash) && !(v.key?("adapter") || v.key?("url")) } config.merge! env_config if env_config config.each do |key, value| diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index 88d28dc52a..ee0e651912 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -57,6 +57,10 @@ module ActiveRecord spec = resolver.resolve(config).symbolize_keys spec[:name] = spec_name + # use the primary config if a config is not passed in and + # it's a three tier config + spec = spec[spec_name.to_sym] if spec[spec_name.to_sym] + connection_handler.establish_connection(spec) end |