Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Track object ids so the objects needn't respond to ==

  • Loading branch information...
commit da3a80dd4fadde9b3bd671c72b5bee737fb70e39 1 parent dc2caea
@jeremy jeremy authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 activesupport/lib/active_support/json/encoding.rb
View
4 activesupport/lib/active_support/json/encoding.rb
@@ -6,8 +6,8 @@ class CircularReferenceError < StandardError
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.