WARNING: be careful what you do with this.
- Create a
scripts
directory in your Rails app root (if it doesn't already exist) and put the script inside
$ ruby scripts/use_heroku_db.rb
Run the script with to copy credentials from Heroku DB to your "database.yml".
Your previous "database.yml" will be backed up to "config/database.yml.orig". Run the script again to automatically restore your original "database.yml".
You can pass an optional remote name if you have multiple Heroku apps. E.g. if you've got "staging" and "production" remotes, you can get staging's DB credentials with:
$ ruby scripts/use_heroku_db.rb staging