- 03 12月, 2013 1 次提交
-
-
由 Godfrey Chan 提交于
Also added the missing CHANGELOG entry for #12183 @ 80e75520 and 4d02296c.
-
- 01 12月, 2013 1 次提交
-
-
由 Godfrey Chan 提交于
-
- 27 11月, 2013 3 次提交
-
-
由 Godfrey Chan 提交于
-
由 Godfrey Chan 提交于
Got all the tests passing again. Support for `encode_json` has been removed (and consequently the ability to encode `BigDecimal`s as numbers, as mentioned in the previous commit). Install the `activesupport-json_encoder` gem to get it back.
-
由 Godfrey Chan 提交于
This is because the new encoder will no longer support encode_json. Therefore our only choice is to return `to_i` or `to_s` in `BigDecimal#as_json`. Since casting a BigDecimal to an integer is most likely a lossy operation, we chose to encode it as a string. Support for encoding BigDecimal as a string will return via the `activesupport-json_encoder` gem.
-
- 07 11月, 2013 3 次提交
-
-
由 Godfrey Chan 提交于
In #12203, the JSON core extensions were moved into the `core_ext` folder. Unfortunately, there are some corresponding requires that were left behind. The problem is partially addressed in #12710, this commit fixes the rest.
-
由 Godfrey Chan 提交于
See [1] for why this is not a good idea. As part of this refactor, circular reference protection in as_json has been removed and the corresponding error class has been deprecated. As discussed with @jeremy, circular reference error is considered programmer errors and protecting against it is out of scope for the encoder. This is again based on the excellent work by @sergiocampama in #11728. [1]: https://github.com/intridea/multi_json/pull/138#issuecomment-24468223
-
由 Godfrey Chan 提交于
-
- 31 10月, 2013 2 次提交
-
-
由 Robin Dupret 提交于
Same as #12710 but for the time module this time. This time it should fix the Active Model test suite in isolation avoiding a TypeError to be raised about the superclass of the DateTime object.
-
由 Robin Dupret 提交于
If we try to monkey-patch the class before requiring it, then a "superclass mismatch" (TypeError) error is raised and the build can't run correctly. Fixes #12708
-
- 13 9月, 2013 1 次提交
-
-
由 Godfrey Chan 提交于
TL;DR The primary driver is to remove autoload surprise. This is related to #12106. (The root cause for that ticket is that json/add defines Regexp#to_json among others, but here I'll reproduce the problem without json/add.) Before: >> require 'active_support/core_ext/to_json' => true >> //.as_json NoMethodError: undefined method `as_json' for //:Regexp from (irb):3 from /Users/godfrey/.rvm/rubies/ruby-2.0.0-p195/bin/irb:16:in `<main>' >> //.to_json => "\"(?-mix:)\"" >> //.as_json => "(?-mix:)" After: >> require 'active_support/core_ext/to_json' => true >> //.as_json => "(?-mix:)" This is because ActiveSupport::JSON is autoloaded the first time Object#to_json is called, which causes additional core extentions (previously defined in active_support/json/encoding.rb) to be loaded. When someone require 'active_support/core_ext', the expectation is that it would add certain methods to the core classes NOW. The previous behaviour causes additional methods to be loaded the first time you call `to_json`, which could cause nasty surprises and other unplesant side-effects. This change moves all core extensions in to core_ext/json. AS::JSON is still autoloaded on first #to_json call, but since it nolonger include the core extensions, it should address the aforementioned bug. *Requiring core_ext/object/to_json now causes a deprecation warnning*
-
- 01 6月, 2013 1 次提交
-
-
由 kennyj 提交于
-
- 11 5月, 2013 1 次提交
-
-
由 Rafael Mendonça França 提交于
Since Ruby 2.0 is UTF-8 by default we need to explictly say that the encoding of this file is US-ASCII
-
- 09 5月, 2013 1 次提交
-
-
由 Mario Caropreso 提交于
U+2028 and U+2029 are allowed inside strings in JSON (as all literal Unicode characters) but JavaScript defines them as newline seperators. Because no literal newlines are allowed in a string, this causes a ParseError in the browser. We work around this issue by replacing them with the escaped version. The resulting JSON is still valid and can be parsed in the browser. This commit has been coauthored with Viktor Kelemen @yikulju
-
- 03 4月, 2013 1 次提交
-
-
由 zackham 提交于
Currently, json/encoding respects the JSON spec (as it should) which disallows \n and \r inside strings, escaping them as expected. Unfortunately, ECMA-262 (Javascript) disallows not only \n and \r in strings, but "Line Terminators" which includes U+2028 and U+2029. See here: http://bclary.com/2004/11/07/#a-7.3 This pull request adds U+2028 and U+2029 to be escaped. # Why? It's very common to see something like this in a Rails template: <script type="text/javascript"> var posts = <%= @posts.to_json %>; </script> If U+2028 or U+2029 are part of any attributes output in the to_json call, you will end up with an exception. In Chrome: Uncaught SyntaxError: Unexpected token ILLEGAL # Why not? This is JSON encoding, and the JSON spec is specific about how to encode strings. U+2028 and U+2029 don't get special treatment. Just trying to start a discussion... what do you do in your apps to deal with this? Is there a convention I'm missing?
-
- 25 2月, 2013 1 次提交
-
-
由 Guillermo Iguaran 提交于
This reverts commit 046e27a7. Check https://github.com/rails/rails/pull/8815#issuecomment-14026122 for details.
-
- 07 1月, 2013 2 次提交
-
-
由 Gosha Arinich 提交于
-
由 Bogdan Gusiev 提交于
-
- 15 12月, 2012 1 次提交
-
-
由 Brett Carter 提交于
The encoding scheme (e.g.
☠ -> "\u2620") was broken for characters not in the Basic Multilingual Plane. It is possible to escape them for json using the weird encoding scheme of a twelve-character sequence representing the UTF-16 surrogate pair (e.g. '𠜎' -> "\u270e\u263a") but this wasn't properly handled in the escaping code. Since raw UTF-8 is allowed in json, it was decided to simply pass through the raw bytes rather than attempt to escape them.
-
- 12 11月, 2012 1 次提交
-
-
由 Yves Senn 提交于
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.
-
- 15 9月, 2012 1 次提交
-
-
由 Francesco Rodriguez 提交于
-
- 08 8月, 2012 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 22 7月, 2012 1 次提交
-
-
由 Francesco Rodriguez 提交于
-
- 31 5月, 2012 2 次提交
-
-
由 Erich Menge 提交于
-
由 Erich Menge 提交于
-
- 30 5月, 2012 1 次提交
-
-
由 Erich Menge 提交于
-
- 28 5月, 2012 1 次提交
-
-
由 Francesco Rodriguez 提交于
-
- 14 5月, 2012 1 次提交
-
-
由 José Valim 提交于
-
- 02 5月, 2012 1 次提交
-
-
由 David FRANCOIS 提交于
-
- 01 5月, 2012 1 次提交
-
-
由 Sebi Burkhard 提交于
-
- 09 2月, 2012 1 次提交
-
-
由 Uddhava 提交于
-
- 13 1月, 2012 1 次提交
-
-
由 Vijay Dev 提交于
-
- 06 1月, 2012 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 02 1月, 2012 1 次提交
-
-
由 Sergey Nartimov 提交于
-
- 25 12月, 2011 1 次提交
-
-
由 Sergey Nartimov 提交于
-
- 01 12月, 2011 1 次提交
-
-
由 José Valim 提交于
This reverts commit 8896b4fd. Conflicts: activemodel/lib/active_model.rb activemodel/lib/active_model/serializable.rb activemodel/lib/active_model/serializer.rb activemodel/test/cases/serializer_test.rb
-
- 24 11月, 2011 1 次提交
-
-
由 José Valim 提交于
The following constants were renamed: ActiveModel::Serialization => ActiveModel::Serializable ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON ActiveModel::Serializers::Xml => ActiveModel::Serializable::XML The main motivation for such a change is that `ActiveModel::Serializers::JSON` was not actually a serializer, but a module that when included allows the target to be serializable to JSON. With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
-
- 30 9月, 2011 1 次提交
-
-
由 José Valim 提交于
-
- 15 8月, 2011 1 次提交
-
-
由 Sebi Burkhard 提交于
-
- 26 5月, 2011 1 次提交
-
-
由 Josh Kalderimis 提交于
-