diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-26 15:04:02 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-04-26 15:04:02 -0700 |
commit | da3a80dd4fadde9b3bd671c72b5bee737fb70e39 (patch) | |
tree | dc20de6f0190ffe3f0f7b160d029a038ffe745d0 /activesupport/lib | |
parent | dc2caea9dc1535f30e8809b489c4ec1cf35febe6 (diff) | |
download | rails-da3a80dd4fadde9b3bd671c72b5bee737fb70e39.tar.gz rails-da3a80dd4fadde9b3bd671c72b5bee737fb70e39.tar.bz2 rails-da3a80dd4fadde9b3bd671c72b5bee737fb70e39.zip |
Track object ids so the objects needn't respond to ==
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/json/encoding.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index 42a217cedc..e8e9308495 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -6,8 +6,8 @@ module ActiveSupport # Converts a Ruby object into a JSON string. def self.encode(value, options = {}) seen = (options[:seen] ||= []) - raise CircularReferenceError, 'object references itself' if seen.include?(value) - seen << value + raise CircularReferenceError, 'object references itself' if seen.include?(value.object_id) + seen << value.object_id value.send(:rails_to_json, options) ensure seen.pop |