Revert "Merge pull request #21995 from tak1n/master"

This reverts commit 4973704bf5, reversing
changes made to 78edeb3334.
This commit is contained in:
Jon Moss 2016-08-26 10:15:01 -04:00
parent 56fe966e6a
commit 5fb513f26a
1 changed files with 8 additions and 35 deletions

View File

@ -1217,48 +1217,21 @@ 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 the `config.x` property. It works like this:
```ruby
config.payment_processing.schedule = :daily
config.payment_processing.retries = 3
config.super_debugger = true
config.x.payment_processing.schedule = :daily
config.x.payment_processing.retries = 3
config.x.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
```
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
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
```
Search Engines Indexing