aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
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-12 16:06:08 +0100
commit78dca351037c5f34971bdf0dd7d0b8fc9b9bdeb4 (patch)
treefc3a9536930132ae531f8e442359ff57f40dc236 /activesupport/lib
parent2f3d81c764a8b527299be8c33c64814431f83482 (diff)
downloadrails-78dca351037c5f34971bdf0dd7d0b8fc9b9bdeb4.tar.gz
rails-78dca351037c5f34971bdf0dd7d0b8fc9b9bdeb4.tar.bz2
rails-78dca351037c5f34971bdf0dd7d0b8fc9b9bdeb4.zip
`#as_json` isolates options when encoding a hash. Closes #8182
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.
Diffstat (limited to 'activesupport/lib')
-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 f65c831e04..7a5c351ca8 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -65,7 +65,7 @@ module ActiveSupport
# they can detect circular references.
options.merge(:encoder => self)
else
- options
+ options.dup
end
end