diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-08-26 10:20:18 -0400 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-08-26 10:20:18 -0400 |
commit | 01dca5b4b38d669e555be87743c1e1a7ad2e23b1 (patch) | |
tree | 72e7cd1661c2511d5bb376d429d96b8822db7d3f /guides/source | |
parent | 5fb513f26a305608483c9c2fa99625728761dfd6 (diff) | |
download | rails-01dca5b4b38d669e555be87743c1e1a7ad2e23b1.tar.gz rails-01dca5b4b38d669e555be87743c1e1a7ad2e23b1.tar.bz2 rails-01dca5b4b38d669e555be87743c1e1a7ad2e23b1.zip |
Add back in `config_for` example
[ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/configuring.md | 28 |
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 ----------------------- |