Repository navigation
Fix AM::Serializers::JSON#as_json method for timestamps - #31503
Merged
Merged
Conversation
|
r? @eileencodes (@rails-bot has picked a reviewer for you, use r? to override) |
According to doc the method should return non-json compatible types as strings.
bogdan
force-pushed
the
timestamp-as-json
branch
from
December 21, 2017 09:07
602c3f3 to
2e5cb98
Compare
Contributor
Author
|
@eileencodes any thoughts on this bugfix? |
bogdanvlviv
added a commit
to bogdanvlviv/rails
that referenced
this pull request
Aug 11, 2018
``` ... (snip) ............F Failure: JsonSerializationTest#test_as_json_should_return_a_hash_if_include_root_ in_json_is_true [/home/travis/build/rails/rails/activemodel/test/cases/serializers/json_serialization_test.rb:145]: Expected: 2006-08-01 00:00:00 UTC Actual: "2006-08-01T00:00:00.000Z" rails test home/travis/build/rails/rails/activemodel/test/cases/serializers/json_serialization_test.rb:136 (snip) ... ``` Related to rails#31503
Merged
Contributor
|
How about adding changelog entry for this change? |
bogdanvlviv
added a commit
to bogdanvlviv/rails
that referenced
this pull request
Aug 12, 2018
eileencodes
added a commit
that referenced
this pull request
Aug 12, 2018
Add changelog entry for #31503 [ci skip]
Member
|
Isn't it backward incompatible change? |
thomasleese
added a commit
to alphagov/email-alert-api
that referenced
this pull request
Jan 15, 2020
We were relying on old behaviour of as_json which is that it would return a date object for dates rather than a string (since JSON doesn't support date objects). See rails/rails#31503 for more details.
oscarwyatt
pushed a commit
to alphagov/email-alert-api
that referenced
this pull request
Feb 24, 2020
We were relying on old behaviour of as_json which is that it would return a date object for dates rather than a string (since JSON doesn't support date objects). See rails/rails#31503 for more details.
MuriloDalRi
pushed a commit
to alphagov/email-alert-api
that referenced
this pull request
Feb 27, 2020
We were relying on old behaviour of as_json which is that it would return a date object for dates rather than a string (since JSON doesn't support date objects). See rails/rails#31503 for more details.
pixeltrix
added a commit
to alphagov/whitehall
that referenced
this pull request
Jan 3, 2021
In rails/rails#31503 the output of as_json was fixed to make sure that any returned types were JSON-compatible, e.g. symbols and timestamps are now converted to strings.
thomasleese
pushed a commit
to alphagov/whitehall
that referenced
this pull request
Jan 12, 2021
In rails/rails#31503 the output of as_json was fixed to make sure that any returned types were JSON-compatible, e.g. symbols and timestamps are now converted to strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to doc the method should return
non-json compatible types as strings.
The original idea behind
as_jsonis that:This patch fixes the compatibility for types that are not supported by JSON.
Also this patch makes
Hash#as_jsoncompatibleAR::Base#as_json: