aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-07-08 05:06:25 -0400
committerGitHub <noreply@github.com>2019-07-08 05:06:25 -0400
commit84ff4f6ea2a118b47160e3fe7ed29bff52c2a7a2 (patch)
tree7170c5c0159b5c0c8d0a0202021cd8d16b3700c5 /activerecord/lib/active_record
parent7729dfc6ef0bfddcf55c214b86c7e2530024d58a (diff)
parentff42b21915c08cf44f2c263dfe13c249dd780528 (diff)
downloadrails-84ff4f6ea2a118b47160e3fe7ed29bff52c2a7a2.tar.gz
rails-84ff4f6ea2a118b47160e3fe7ed29bff52c2a7a2.tar.bz2
rails-84ff4f6ea2a118b47160e3fe7ed29bff52c2a7a2.zip
Merge pull request #36617 from wjessop/fix_database_url_trampling_other_env_configs
When DATABASE_URL is specified don't trample envs that use a url: key
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/database_configurations.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/database_configurations.rb b/activerecord/lib/active_record/database_configurations.rb
index b917f4e6b7..bf31bb7c22 100644
--- a/activerecord/lib/active_record/database_configurations.rb
+++ b/activerecord/lib/active_record/database_configurations.rb
@@ -153,11 +153,11 @@ module ActiveRecord
def build_url_config(url, configs)
env = ActiveRecord::ConnectionHandling::DEFAULT_ENV.call.to_s
- if original_config = configs.find(&:for_current_env?)
- if original_config.url_config?
- configs
- else
- configs.map do |config|
+ if configs.find(&:for_current_env?)
+ configs.map do |config|
+ if config.url_config?
+ config
+ else
ActiveRecord::DatabaseConfigurations::UrlConfig.new(config.env_name, config.spec_name, url, config.config)
end
end