diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-08-19 20:07:39 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2014-08-19 21:59:01 -0300 |
commit | 2f7ac9cdcc06f3c84eb3d905d16da9ca22ef2c66 (patch) | |
tree | 140a2e59ff3309bbe8f9093b6d014a06d5b0c4a2 /railties/lib/rails/application | |
parent | e2066818e82799ab7eee15d4d5248c4d16edf6ba (diff) | |
download | rails-2f7ac9cdcc06f3c84eb3d905d16da9ca22ef2c66.tar.gz rails-2f7ac9cdcc06f3c84eb3d905d16da9ca22ef2c66.tar.bz2 rails-2f7ac9cdcc06f3c84eb3d905d16da9ca22ef2c66.zip |
Fix setting simple values to the new config.x
Previously setting simple values to the config.x object resulted in the
following:
config.x.super_debugger = true
config.x.super_debugger #=> {}
Which was against the examples showed in the changelog/release notes.
Diffstat (limited to 'railties/lib/rails/application')
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index 782bc4b0f1..9a6a4a52c7 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -155,15 +155,21 @@ module Rails def annotations SourceAnnotationExtractor::Annotation end - + private - class Custom + class Custom #:nodoc: def initialize @configurations = Hash.new end - + def method_missing(method, *args) - @configurations[method] ||= ActiveSupport::OrderedOptions.new + if method =~ /=$/ + @configurations[$`.to_sym] = args.first + else + @configurations.fetch(method) { + @configurations[method] = ActiveSupport::OrderedOptions.new + } + end end end end |