Skip to content
Browse files

Merge pull request #4963 from ram123naresh/update_rails_2_use1_9

Replaced OrderedHash usage with Ruby 1.9 Hash
  • Loading branch information...
2 parents d36a884 + 53f442b commit b171db87e2e651602d8f2cf7fd39e4f52319cf48 @spastorino spastorino committed Feb 9, 2012
Showing with 1 addition and 3 deletions.
  1. +1 −3 activesupport/lib/active_support/json/encoding.rb
View
4 activesupport/lib/active_support/json/encoding.rb
@@ -1,7 +1,6 @@
require 'active_support/core_ext/object/to_json'
require 'active_support/core_ext/module/delegation'
require 'active_support/json/variable'
-require 'active_support/ordered_hash'
require 'bigdecimal'
require 'active_support/core_ext/big_decimal/conversions' # for #to_s
@@ -239,8 +238,7 @@ def as_json(options = nil) #:nodoc:
# use encoder as a proxy to call as_json on all values in the subset, to protect from circular references
encoder = options && options[:encoder] || ActiveSupport::JSON::Encoding::Encoder.new(options)
- result = self.is_a?(ActiveSupport::OrderedHash) ? ActiveSupport::OrderedHash : Hash
- result[subset.map { |k, v| [k.to_s, encoder.as_json(v, options)] }]
+ Hash[subset.map { |k, v| [k.to_s, encoder.as_json(v, options)] }]
end
def encode_json(encoder)

0 comments on commit b171db8

Please sign in to comment.
Something went wrong with that request. Please try again.