If you don’t want to commit sensitive info to your database.yml file, don’t use your database.yml file. Instead set an environment variable with DATABASE_URL=yourconnectionstring
This is supported on Rails 4.0 as far as I know, if you run into problems message me, I’ll be happy to take a look.
In general ask yourself, “can I open source my project if I really wanted to right now without opening up a giant security flaw”. If the answer is no, put whatever sensitive data opens that flaw into an environment variable and then have your ruby code read from that variable like: ENV[“DATABASE_URL”].
In development i use Foreman and a .env file for sensitive credentials. In production you could use the same, put it in your bash files, or use config vars if you’re using Heroku.