Flowdock
method

config_for

Importance_2
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: Rails::Application
config_for(name, env: Rails.env) public

Convenience for loading config/foo.yml for the current Rails env.

Examples:

# config/exception_notification.yml:
production:
  url: http://127.0.0.1:8080
  namespace: my_app_production

development:
  url: http://localhost:3001
  namespace: my_app_development

# config/environments/production.rb
Rails.application.configure do
  config.middleware.use ExceptionNotifier, config_for(:exception_notification)
end

# You can also store configurations in a shared section which will be
# merged with the environment configuration

# config/example.yml
shared:
  foo:
    bar:
      baz: 1

development:
  foo:
    bar:
      qux: 2

# development environment
Rails.application.config_for(:example)[:foo][:bar]
# => { baz: 1, qux: 2 }
Show source
Register or log in to add new notes.