From be79632b96d6fe6b844c99561ce96f540e98cae0 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Mon, 12 Nov 2012 14:33:20 +0100 Subject: backport #8185, `#as_json` isolates options when encoding a hash. Setting options in a custom `#as_json` method had side effects. Modifications of the `options` hash leaked outside and influenced the conversion of other objects contained in the hash. Conflicts: activesupport/CHANGELOG.md --- activesupport/lib/active_support/json/encoding.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/json') diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index 91e4f07c6c..bd2f909ca9 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -61,7 +61,7 @@ module ActiveSupport # hashes and arrays need to get encoder in the options, so that they can detect circular references options.merge(:encoder => self) else - options + options.dup end end -- cgit v1.2.3