rails/rails — pull request #14029 by senny (2014-02-12 16:23:42+00:00)
Title: do not crash when `config/secrets.yml` is blank.

While working on an application I was facing the following issue:

Our setup script touches a blank `config/secrets.yml` and then executes tasks that load the environment to populate it. In an initializer there is a condition on the existence of a secret. This currently crashes as the loading process expects the file to be populated:

```
/home/travis/build/4teamwork/geschaeftsverzeichnis/vendor/bundle/ruby/2.0.0/gems/railties-4.1.0.beta1/lib/rails/application.rb:310:in `secrets': undefined method `[]' for false:FalseClass (NoMethodError)
```

The use-case presented above is certainly esoteric and could probably be solved otherwise. However I think we should not crash on a blank `config/secrets.yml` with this cryptic error.

Currently a blank `config/database.yml` yields:

```
/Users/senny/Projects/rails/activerecord/lib/active_record/connection_adapters/connection_specification.rb:231:in `resolve_env_connection': 'development' database is not configured. Available configuration: {} (ActiveRecord::AdapterNotSpecified)
```

After this patch a blank `config/secrets.yml` will result in:

```
[2014-02-12 17:10:16] ERROR RuntimeError: Missing `secret_key_base` for 'development' environment, set this value in `config/secrets.yml`
```