diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-12-16 02:37:01 -0800 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-12-16 02:37:01 -0800 |
commit | bd66532ae439341f6978e672687cd4bfb0f0e163 (patch) | |
tree | 3b9c754782efb3c5f8c35016544973147b484655 /railties/lib/rails/commands/dbconsole.rb | |
parent | dfbea4db546cc240b7173109017e43e34b2a1a09 (diff) | |
parent | 971d5107cd4cd08c22a85d34546f4ba03ed5c925 (diff) | |
download | rails-bd66532ae439341f6978e672687cd4bfb0f0e163.tar.gz rails-bd66532ae439341f6978e672687cd4bfb0f0e163.tar.bz2 rails-bd66532ae439341f6978e672687cd4bfb0f0e163.zip |
Merge pull request #13328 from teohm/dbconsole_support_database_url
Fixed rails dbconsole to support DATABASE_URL
Diffstat (limited to 'railties/lib/rails/commands/dbconsole.rb')
-rw-r--r-- | railties/lib/rails/commands/dbconsole.rb | 13 |
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 |