aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2016-08-26 10:24:38 -0400
committerJon Moss <me@jonathanmoss.me>2016-08-26 10:24:38 -0400
commit2f5a40a8000a7b980a87a9748e9df2aa4039756d (patch)
treec4542f465200ce0d836c3b5820535c0d3b45b243 /guides
parent01dca5b4b38d669e555be87743c1e1a7ad2e23b1 (diff)
downloadrails-2f5a40a8000a7b980a87a9748e9df2aa4039756d.tar.gz
rails-2f5a40a8000a7b980a87a9748e9df2aa4039756d.tar.bz2
rails-2f5a40a8000a7b980a87a9748e9df2aa4039756d.zip
Clarify two ways to set Rails configuration options
[ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/configuring.md13
1 files changed, 8 insertions, 5 deletions
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index 47144db0c2..c938edd8f7 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -1217,12 +1217,16 @@ 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 under the `config.x` property. 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.x.payment_processing.schedule = :daily
config.x.payment_processing.retries = 3
- config.x.super_debugger = true
+ config.super_debugger = true
```
These configuration points are then available through the configuration object:
@@ -1230,11 +1234,10 @@ These configuration points are then available through the configuration object:
```ruby
Rails.configuration.x.payment_processing.schedule # => :daily
Rails.configuration.x.payment_processing.retries # => 3
- Rails.configuration.x.super_debugger # => true
- Rails.configuration.x.super_debugger.not_set # => nil
+ 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:
```ruby