rails/rails — pull request #5184 by Bodacious (2012-02-26 19:35:46+00:00)
Title: DRYed database config YAML templates

I've taken each of the database YAML config files and rewritten them.

The default values are all the same as before, I've just moved the duplication into a defaults block and then included this in each environment's settings.

I know a few developers who re-write their database files like this so I thought I'd save us all the effort in future.

## Before

``` yaml
development:
adapter: mysql2
encoding: utf8
database: my_app_development
pool: 5
username: myAppUser
password: myAppPassword
host: localhost

test:
adapter: mysql2
encoding: utf8
database: my_app_test
pool: 5
username: myAppUser
password: myAppPassword
host: localhost

production:
adapter: mysql2
encoding: utf8
database: my_app_production
pool: 5
username: myLiveAppUser
password: myLivePassword
host: localhost
```
## After

``` yaml
defaults: &defaults
adapter: mysql2
encoding: utf8
database: my_app_development
pool: 5
username: myAppUser
password: myAppPassword
host: localhost

development:
<<: *defaults
database: my_app_development

test:
<<: *defaults
database: my_app_test

production:
<<: *defaults
database: my_app_production
username: myLiveAppUser
password: myLivePassword
```