aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorEileen Uchitelle <eileencodes@gmail.com>2018-08-29 10:26:44 -0400
committerEileen Uchitelle <eileencodes@gmail.com>2018-08-29 10:26:44 -0400
commit6b5df90fb56d86f0cd04a27a94dfe876e21fa001 (patch)
tree3a351a1903b836776a4c09822e1290f971d2531d /activerecord
parent4f09cff52c0ef771baac5f25c7c87a65068c0729 (diff)
downloadrails-6b5df90fb56d86f0cd04a27a94dfe876e21fa001.tar.gz
rails-6b5df90fb56d86f0cd04a27a94dfe876e21fa001.tar.bz2
rails-6b5df90fb56d86f0cd04a27a94dfe876e21fa001.zip
Drop load_database_yaml and fix test
We originally did the whole `load_database_yaml` thing because this test wasn't cooperating and we needed to finish the namespaced rake tasks for multiple databases. However, it turns out that YAML can't eval ERB if you don't tell it it's ERB so you get Pysch parse errors if you're using multi-line ERB or ERB with conditionals. It's a hot mess. After trying a few things and thinking it over we decided that it wasn't worth bandaiding over, the test needed to be improved. The test was added in #31135 to test that the env is loaded in these tasks. But it was blowing up because we were trying to read a database name out of the configuration - however that's not the purpose of this change. We want to read environment files in the rake tasks, but not in the config file. In this PR we changed the test to test what the PR was actually fixing. We've also deleted the `load_database_yaml` because it caused more problems than it was worth. This should fix the issues described in https://github.com/rails/rails/pull/32274#issuecomment-384161057. We also had these problems at GitHub. Co-authored-by: alimi <aibrahim2k2@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/tasks/database_tasks.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb
index fd36c0abd2..62c5adac2b 100644
--- a/activerecord/lib/active_record/tasks/database_tasks.rb
+++ b/activerecord/lib/active_record/tasks/database_tasks.rb
@@ -135,7 +135,7 @@ module ActiveRecord
end
def for_each
- databases = Rails.application.config.load_database_yaml
+ databases = Rails.application.config.database_configuration
database_configs = ActiveRecord::DatabaseConfigurations.configs_for(Rails.env, databases)
# if this is a single database application we don't want tasks for each primary database