aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/commands/dbconsole.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/railties/lib/rails/commands/dbconsole.rb b/railties/lib/rails/commands/dbconsole.rb
index 3e4cc787c4..847447fdad 100644
--- a/railties/lib/rails/commands/dbconsole.rb
+++ b/railties/lib/rails/commands/dbconsole.rb
@@ -81,14 +81,11 @@ module Rails
def config
@config ||= begin
- cfg = begin
- YAML.load(ERB.new(IO.read("config/database.yml")).result)
- rescue SyntaxError, StandardError
- require APP_PATH
- Rails.application.config.database_configuration
- end
-
- cfg[environment] || abort("No database is configured for the environment '#{environment}'")
+ require APP_PATH
+ ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new(
+ ENV['DATABASE_URL'],
+ (Rails.application.config.database_configuration || {})
+ ).spec.config.stringify_keys
end
end