diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2013-12-23 20:15:52 +0100 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2013-12-23 20:15:52 +0100 |
commit | c390e60811b2e11bfd5d79b15bfb43690c1a1339 (patch) | |
tree | acac77d1a71e5e2091b6abdd3a1c7146a6832960 /activerecord/lib/active_record/tasks | |
parent | d22a359a18d4ff0e31cb96293f03687e5db719ba (diff) | |
download | rails-c390e60811b2e11bfd5d79b15bfb43690c1a1339.tar.gz rails-c390e60811b2e11bfd5d79b15bfb43690c1a1339.tar.bz2 rails-c390e60811b2e11bfd5d79b15bfb43690c1a1339.zip |
Guarantee the connection resolver handles string values
This commit also cleans up the rake tasks that were checking
for DATABASE_URL in different places.
In fact, it would be nice to deprecate DATABASE_URL usage in the long
term, considering the direction we are moving of allowing those in .yml
files.
Diffstat (limited to 'activerecord/lib/active_record/tasks')
-rw-r--r-- | activerecord/lib/active_record/tasks/database_tasks.rb | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index be7d496d15..06592eece2 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -56,11 +56,7 @@ module ActiveRecord if options.has_key?(:config) @current_config = options[:config] else - @current_config ||= if ENV['DATABASE_URL'] - database_url_config - else - ActiveRecord::Base.configurations[options[:env]] - end + @current_config ||= ActiveRecord::Base.configurations[options[:env]] end end @@ -85,10 +81,6 @@ module ActiveRecord ActiveRecord::Base.establish_connection environment end - def create_database_url - create database_url_config - end - def drop(*arguments) configuration = arguments.first class_for_adapter(configuration['adapter']).new(*arguments).drop @@ -107,10 +99,6 @@ module ActiveRecord } end - def drop_database_url - drop database_url_config - end - def charset_current(environment = env) charset ActiveRecord::Base.configurations[environment] end @@ -165,11 +153,6 @@ module ActiveRecord private - def database_url_config - @database_url_config ||= - ConnectionAdapters::ConnectionSpecification::Resolver.new(ENV["DATABASE_URL"], {}).spec.config.stringify_keys - end - def class_for_adapter(adapter) key = @tasks.keys.detect { |pattern| adapter[pattern] } unless key |