aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json/encoding.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-04-26 15:18:33 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-04-26 15:18:33 -0700
commit8d64085138b1a2ff36b94267d0236868b287610e (patch)
tree928eba809df85dfe47195f05171d60af3dec6665 /activesupport/lib/active_support/json/encoding.rb
parentbe7e21a85c487b6f3bfc2e393387ada5cc52290d (diff)
downloadrails-8d64085138b1a2ff36b94267d0236868b287610e.tar.gz
rails-8d64085138b1a2ff36b94267d0236868b287610e.tar.bz2
rails-8d64085138b1a2ff36b94267d0236868b287610e.zip
Only Object to_json alias is needed. Prefer nil options.
Diffstat (limited to 'activesupport/lib/active_support/json/encoding.rb')
-rw-r--r--activesupport/lib/active_support/json/encoding.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index e8e9308495..acccb62aea 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -4,7 +4,8 @@ module ActiveSupport
end
# Converts a Ruby object into a JSON string.
- def self.encode(value, options = {})
+ def self.encode(value, options = nil)
+ options ||= {}
seen = (options[:seen] ||= [])
raise CircularReferenceError, 'object references itself' if seen.include?(value.object_id)
seen << value.object_id