New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveSupport::TimeWithZone not serialized like JSON #408
Comments
I'll need more detail. The title implies you are using Rails or ActiveSupport yet you show code for the json gem only. What other initialization was done? There is a lot of interplay between ActiveSupport, the json gem, and Oj. |
@ohler55 Thanks I updated with rails, ruby and json version. something else ? |
I just reproduced with a clean Rails app with the specified versions |
You are experiencing the Rails vs json gem conflicts. You will see that Unfortunately the complexity and performance penalty for putting in conditional checks for the various combinations of ActiveSupport and json gem versions along with whether ActiveSupport is present to not is prohibitive. The current tests are for two general cases:
In case 2 no attempt is made to bypass the ActiveSupport changes in favor of the json gem version except for the Oj.generate method which should match JSON.generate. So, finally after trying to explain the mess, if you want to use Rails and then call the json gem calls directly then the |
thanks @ohler55 For the explanation :)
|
That is odd. It worked for me but that was with ActiveRecord 5 and a newer json gem. The core of the issue is with the to_json or as_json method. Are you able to change either of those? |
What is the status of this issue? Still open? If so did you try the suggested change? |
Assuming it is closed. |
I believe the behavior described here was addressed by #654 |
output:
Updated:
Using Rails 4.1.16
Ruby 2.2.7
json: 1.8.6
Oj: 3.3.2
The text was updated successfully, but these errors were encountered: