diff options
author | eileencodes <eileencodes@gmail.com> | 2018-03-16 12:40:34 -0400 |
---|---|---|
committer | eileencodes <eileencodes@gmail.com> | 2018-03-16 12:40:34 -0400 |
commit | 4027643f7f7eed9186d158fe5b1f21d0d6de8fe1 (patch) | |
tree | fc0a59bca8f6f2c782410b7b0bbfb5553202161c /railties/lib/rails | |
parent | 03929463192be49acfb3660160543e48b0960fd1 (diff) | |
download | rails-4027643f7f7eed9186d158fe5b1f21d0d6de8fe1.tar.gz rails-4027643f7f7eed9186d158fe5b1f21d0d6de8fe1.tar.bz2 rails-4027643f7f7eed9186d158fe5b1f21d0d6de8fe1.zip |
Switch dbconsole config loader check
In a three-tier config environment
`configurations[environment].presence` will return `{ :primary => {
:key => value, :key => value }, :secondary => { :key => value, :key =>
value} }, which means it's not given a single config to connect to.
If we flip these however it will connect to primary because that's the
default connection, and on a two tier it will be `nil` so the code will
select the connection from the configurations rather than the
connection.
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/commands/dbconsole/dbconsole_command.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails/commands/dbconsole/dbconsole_command.rb b/railties/lib/rails/commands/dbconsole/dbconsole_command.rb index 8df548b5de..806b7de6d6 100644 --- a/railties/lib/rails/commands/dbconsole/dbconsole_command.rb +++ b/railties/lib/rails/commands/dbconsole/dbconsole_command.rb @@ -97,7 +97,7 @@ module Rails elsif configurations[environment].blank? && configurations[connection].blank? raise ActiveRecord::AdapterNotSpecified, "'#{environment}' database is not configured. Available configuration: #{configurations.inspect}" else - configurations[environment].presence || configurations[connection] + configurations[connection] || configurations[environment].presence end end end |