1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
eileencodes 2018-03-16 12:40:34 -04:00
parent 0392946319
commit 4027643f7f

View file

@ -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