diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-03-26 16:37:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-26 16:37:21 -0400 |
commit | 93e6b5c27bfdfd75714233772bf2b19045c7d1a9 (patch) | |
tree | b070f1827ed2e782715237b5ab2c3eb1cc5d3a76 /railties/lib/rails | |
parent | 2baf1aaeb1e1385ad2bf20728f4bc8c24efc7245 (diff) | |
parent | 4e663c1e8d1e643783f157f904b5276e62f65589 (diff) | |
download | rails-93e6b5c27bfdfd75714233772bf2b19045c7d1a9.tar.gz rails-93e6b5c27bfdfd75714233772bf2b19045c7d1a9.tar.bz2 rails-93e6b5c27bfdfd75714233772bf2b19045c7d1a9.zip |
Merge pull request #32274 from eileencodes/part-1-add-rake-tasks-for-multi-db
Part 1 Easy Multi db in Rails: Add basic rake tasks for multi db setup
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 912faed3e4..f80da4b005 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -166,6 +166,18 @@ module Rails end end + # Loads the database YAML without evaluating ERB. People seem to + # write ERB that makes the database configuration depend on + # Rails configuration. But we want Rails configuration (specifically + # `rake` and `rails` tasks) to be generated based on information in + # the database yaml, so we need a method that loads the database + # yaml *without* the context of the Rails application. + def load_database_yaml # :nodoc: + path = paths["config/database"].existent.first + return {} unless path + YAML.load_file(path.to_s) + end + # Loads and returns the entire raw configuration of database from # values stored in <tt>config/database.yml</tt>. def database_configuration |