rails/rails — pull request #6833 by macksmind (2012-06-22 23:20:44+00:00)
Title: Ensure DATABASE_URL is not ignored when database.yml isn't loaded

Currently specifying an environment name when DATABASE_URL is present
prevents a sucessful connection. Passing a string such as "production"
causes DATABASE_URL to be ignored because
ActiveRecord::Base.establish_connection only uses it if no name is
passed, but database.yml isn't loaded by the initializer if DATABASE_URL
is defined.

This change causes the resolver to use DATABASE_URL instead of failing
on an unusable environment name without breaking the ability to
pass a valid url in a string.

Among other things, this fixes rake db:fixtures:load on Heroku Cedar.