diff options
author | Mauro Berlanda <mauro.berlanda@gmail.com> | 2018-10-19 14:37:06 +0200 |
---|---|---|
committer | Mauro Berlanda <mauro.berlanda@gmail.com> | 2018-10-19 14:37:06 +0200 |
commit | 264152af2b0c210b4c2e4865e337eaa07836c948 (patch) | |
tree | f67652a0f03674c84062d1a71809df062ee97ef8 /railties/lib | |
parent | 86a12b6f2932ba1a3b5f0417688ffe34ea6bab25 (diff) | |
download | rails-264152af2b0c210b4c2e4865e337eaa07836c948.tar.gz rails-264152af2b0c210b4c2e4865e337eaa07836c948.tar.bz2 rails-264152af2b0c210b4c2e4865e337eaa07836c948.zip |
chore: implement config_for as ActiveSupport::OrderedOptions
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 656786246d..acd97b64bf 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -232,10 +232,12 @@ module Rails if yaml.exist? require "erb" - require "active_support/ordered_options" + config = YAML.load(ERB.new(yaml.read).result) || {} + config = (config["shared"] || {}).merge(config[env] || {}) - config = (YAML.load(ERB.new(yaml.read).result) || {})[env] || {} - ActiveSupport::InheritableOptions.new(config.deep_symbolize_keys) + ActiveSupport::OrderedOptions.new.tap do |config_as_ordered_options| + config_as_ordered_options.update(config.deep_symbolize_keys) + end else raise "Could not load configuration. No such file - #{yaml}" end |