The config/database.yml file no longer generated for applications using ActiveRecord 4.1+
Change effective on 31 August 2015
Previously Ruby applications using Rails 4.1+ would skip generation of a
config/database.yml file since Rails 4.1+ supports DATABASE_URL configuration directly. Rails 4.1+ uses ActiveRecord 4.1+. Since it is possible to use ActiveRecord without Rails, the logic was changed so that now
applications using Active Record 4.1+ will not have a database.yml written. This will allow developers using ActiveRecord (without Rails) to specify configuration options such as pool size in their
config/database.yml files and should not affect database connection behavior since the underlying
DATABASE_URL configuration variable will be detected and used. Applications using Rails will see no change in behavior.
If you’re using
sinatra-activerecord this upgrade should be seamless for you, however we’ve had reports that there are problems with several versions. If you encounter a problem you can add a
database.yml to your git repo to be able to deploy.
Add a database.yml and specify DATABASE_URL in production
If you don’t want to check for the presence of a YAML file you can alternatively specify
DATABASE_URL directly in your
database.yml like this:
production: url: <%= ENV['DATABASE_URL'] %>
This will only work if you’ve got your code set to understand ERB enhanced YAML files. You can refer to how Rails achieves this. Don’t forget to check your database.yml into git before you deploy.