aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/lib/active_support/json/encoding.rb4
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