aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/configuring.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index c013973d02..47144db0c2 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -1234,6 +1234,34 @@ These configuration points are then available through the configuration object:
Rails.configuration.x.super_debugger.not_set # => nil
```
+
+You can also use `Rails::Application.config_for` to load whole configuration files:
+
+ ```ruby
+ # config/payment.yml:
+ production:
+ environment: production
+ merchant_id: production_merchant_id
+ public_key: production_public_key
+ private_key: production_private_key
+ development:
+ environment: sandbox
+ merchant_id: development_merchant_id
+ public_key: development_public_key
+ private_key: development_private_key
+
+ # config/application.rb
+ module MyApp
+ class Application < Rails::Application
+ config.payment = config_for(:payment)
+ end
+ end
+ ```
+
+ ```ruby
+ Rails.configuration.payment['merchant_id'] # => production_merchant_id or development_merchant_id
+ ```
+
Search Engines Indexing
-----------------------