aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json
diff options
context:
space:
mode:
authorYves Senn <yves.senn@garaio.com>2012-11-12 14:33:20 +0100
committerYves Senn <yves.senn@garaio.com>2012-11-13 08:44:47 +0100
commitbe79632b96d6fe6b844c99561ce96f540e98cae0 (patch)
tree8cb4f4c7cb47541dcbe683c5e986dd0c0fdbdc08 /activesupport/lib/active_support/json
parent618923280048928aff50eed4fe9a9b08f9ebad72 (diff)
downloadrails-be79632b96d6fe6b844c99561ce96f540e98cae0.tar.gz
rails-be79632b96d6fe6b844c99561ce96f540e98cae0.tar.bz2
rails-be79632b96d6fe6b844c99561ce96f540e98cae0.zip
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
Diffstat (limited to 'activesupport/lib/active_support/json')
-rw-r--r--activesupport/lib/active_support/json/encoding.rb2
1 files changed, 1 insertions, 1 deletions
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