rails/rails — pull request #13415 by schneems (2013-12-20 01:18:23+00:00)
Title: Do not expect database user with app name to exist

By default when creating a project with `--database=postgresql` the `config/database.yml` file that is generated has a user specified that is the same as the app name

```
development:
adapter: postgresql
encoding: unicode
database: <%= app_name %>_development
pool: 5
username: <%= app_name %>
password:
```

This is counterintuitive and would rarely be valid. By default postgres creates a user with the current user name:

```
$ whoami
schneems
```

If the `username` is left out postgresql will assume that you wish to log in as the default user

```
$ psql -c '\du'
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
schneems | Superuser, Create role, Create DB, Replication | {}
```

A good sensible default then for auto generated `database.yml` files is to remove the `username`, and have postgres attempt to connect to the database as the currently logged in user.