diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2016-08-26 09:30:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-26 09:30:34 -0500 |
commit | f394f3ba763adbd073685a4a3f53b2a3ad71381a (patch) | |
tree | 6c37bf161e12d4446b2e709cf308aaba6c37fcdf /guides/source | |
parent | c8c8af9c314ce298eda64b580ee91f23491c55ff (diff) | |
parent | 2f5a40a8000a7b980a87a9748e9df2aa4039756d (diff) | |
download | rails-f394f3ba763adbd073685a4a3f53b2a3ad71381a.tar.gz rails-f394f3ba763adbd073685a4a3f53b2a3ad71381a.tar.bz2 rails-f394f3ba763adbd073685a4a3f53b2a3ad71381a.zip |
Merge pull request #26288 from maclover7/jm-revert-21995
Update `Rails.configuration` documentation
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/configuring.md | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/guides/source/configuring.md b/guides/source/configuring.md index 7239105b29..c938edd8f7 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -1217,21 +1217,25 @@ NOTE. If you are running in a multi-threaded environment, there could be a chanc Custom configuration -------------------- -You can configure your own code through the Rails configuration object with custom configuration. It works like this: +You can configure your own code through the Rails configuration object with +custom configuration under either the `config.x` namespace, or `config` directly. +The key difference between these two is that you should be using `config.x` if you +are defining _nested_ configuration (ex: `config.x.nested.nested.hi`), and just +`config` for _single level_ configuration (ex: `config.hello`). ```ruby - config.payment_processing.schedule = :daily - config.payment_processing.retries = 3 + config.x.payment_processing.schedule = :daily + config.x.payment_processing.retries = 3 config.super_debugger = true ``` These configuration points are then available through the configuration object: ```ruby - Rails.configuration.payment_processing.schedule # => :daily - Rails.configuration.payment_processing.retries # => 3 - Rails.configuration.super_debugger # => true - Rails.configuration.super_debugger.not_set # => nil + Rails.configuration.x.payment_processing.schedule # => :daily + Rails.configuration.x.payment_processing.retries # => 3 + Rails.configuration.x.payment_processing.not_set # => nil + Rails.configuration.super_debugger # => true ``` You can also use `Rails::Application.config_for` to load whole configuration files: |