diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2013-11-05 20:05:58 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2013-11-05 22:26:45 -0800 |
commit | ff1192fea40c55a11c52e26f22a814d68d058170 (patch) | |
tree | 6cc0b55aeed8013c2bf9aa39dac0eb4f9733249d /activesupport/lib | |
parent | dcee010ce8c05cd0180e691ca165d774fba60de7 (diff) | |
download | rails-ff1192fea40c55a11c52e26f22a814d68d058170.tar.gz rails-ff1192fea40c55a11c52e26f22a814d68d058170.tar.bz2 rails-ff1192fea40c55a11c52e26f22a814d68d058170.zip |
Eliminate `JSON.{parse,load,generate,dump}` and `def to_json`
JSON.{dump,generate} offered by the JSON gem is not compatiable with
Rails at the moment and can cause a lot of subtle bugs when passed
certain data structures. This changed all direct usage of the JSON gem
in internal Rails code to always go through AS::JSON.{decode,encode}.
We also shouldn't be implementing `to_json` most of the time, and
these occurances are replaced with an equivilent `as_json`
implementation to avoid problems down the road.
See [1] for all the juicy details.
[1]: intridea/multi_json#138 (comment)
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/object/json.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/json.rb b/activesupport/lib/active_support/core_ext/object/json.rb index c50cd57c2c..e2a89f5760 100644 --- a/activesupport/lib/active_support/core_ext/object/json.rb +++ b/activesupport/lib/active_support/core_ext/object/json.rb @@ -91,7 +91,7 @@ end class Float # Encoding Infinity or NaN to JSON should return "null". The default returns - # "Infinity" or "NaN" which breaks parsing the JSON. E.g. JSON.parse('[NaN]'). + # "Infinity" or "NaN" which are not valid JSON. def as_json(options = nil) #:nodoc: finite? ? self : nil end |