Make database.yml optional in Rails
Latest commit b647e64 Jun 22, 2015 @tpope Avoid deprecated alias_method_chain
I don't want to sacrifice 1.9 compatibility so I'm not using


Rails Default Database

Tired of cp config/database.example.yml config/database.yml? Me too. That's why I wrote this Gem. Simply add this line to your Gemfile and PostgreSQL, MySQL, or SQLite3 (depending on which of the 3 is in your Gemfile) will be automatically configured with Rails defaults:

gem 'rails-default-database'

You can still override the defaults by creating config/database.yml. Use rake db:config to create config/database.yml with the defaults that would have been assumed.

As in standard Rails, the DATABASE_URL environment variable takes precedence when defined. However, in the test environment, Rails Default Database will append _test to the database name (after stripping an optional existing environment suffix), ensuring the development (or production!) database is never clobbered. This enables storing your database configuration in .env, if you so choose.


Copyright (c) Tim Pope. MIT License.