diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-19 19:41:15 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-19 19:41:15 -0300 |
commit | 43073b393d234acd094ac7c220163f4e419d11f5 (patch) | |
tree | 0d78982dfb1b93f929cc186c951f775a494af621 /railties/lib/rails/railtie | |
parent | 867631f9cfa6d639baacc09aac76e68819d5501f (diff) | |
download | rails-43073b393d234acd094ac7c220163f4e419d11f5.tar.gz rails-43073b393d234acd094ac7c220163f4e419d11f5.tar.bz2 rails-43073b393d234acd094ac7c220163f4e419d11f5.zip |
Revert "Improve custom configuration"
This reverts commit de4891344ccc074f6d5693f4fac6ad610584e336.
Conflicts:
railties/lib/rails/railtie/configuration.rb
It added regression. Will be back after the beta
Diffstat (limited to 'railties/lib/rails/railtie')
-rw-r--r-- | railties/lib/rails/railtie/configuration.rb | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb index c15cc1a144..eb3b2d8ef4 100644 --- a/railties/lib/rails/railtie/configuration.rb +++ b/railties/lib/rails/railtie/configuration.rb @@ -88,45 +88,11 @@ module Rails def method_missing(name, *args, &blk) if name.to_s =~ /=$/ - key = $`.to_sym - value = args.first - - if value.is_a?(Hash) - @@options[key] = ChainedConfigurationOptions.new value - else - @@options[key] = value - end + @@options[$`.to_sym] = args.first elsif @@options.key?(name) @@options[name] else - @@options[name] = ActiveSupport::OrderedOptions.new - end - end - - class ChainedConfigurationOptions < ActiveSupport::OrderedOptions # :nodoc: - def initialize(value) - value.each_pair { |k, v| set_value k, v } - end - - def method_missing(meth, *args) - if meth =~ /=$/ - key = $`.to_sym - value = args.first - - set_value key, value - else - self.fetch(meth) { super } - end - end - - private - - def set_value(key, value) - if value.is_a?(Hash) - value = self.class.new(value) - end - - self[key] = value + super end end end |