cloudfoundry/heroku-buildpack-ruby — pull request #4 by mrbrdo (2013-11-02 23:30:25+00:00)
Title: Database.yml overwriting not the best idea

First of all the major problem is that this functionality causes problems with JDBC URLs.

I think this (unconditional) overwriting of database.yml is a bad idea. It would be better to allow the user to parse the ENV vars in the way he wants to. Additionally, Rails (at least 4.0.0) already parses DATABASE_URL so this file is kind of pointless then. With JDBC, URLs need to be prefixed with "jdbc:" (at least in certain cases), and that URI.parse cannot parse (same for ActiveRecord, unfortunately, it must be passed as url key in database.yml).

Since committing database.yml is a bad practice anyway, I suggest not to write this unless it does not exist (unfortunately since cf does not git this means adding it to .cfignore, although to be honest I don't understand why you don't simply use .gitignore).
Since you use DATABASE_URL it's probably not even necessary, even when the file is not there. Also, to read from ENV manually is simple enough too:

```yaml
production:
adapter: postgresql
url: "<%= ENV["DATABASE_URL"] %>"
```

In my opinion this overwriting functionality is not needed at all. When you want to operate with DATABASE_URL, Rails will handle it by itself anyway.