This project is archived and is in readonly mode.
BasicObject causing problems with duration.to_json
Reported by Jonathan del Strother | February 9th, 2011 @ 04:41 PM
Heya,
Commit
https://github.com/rails/rails/commit/44db47c63e669bdad74e4ac92a79f...
caused some problems for us with converting durations to json.
Specifically, running -
{:duration => 3.seconds}.to_json
used to return "{'duration':3}" and now returns "{'duration':{}}" on ruby 1.8.7.
I'm currently working around it using :
ActiveSupport::Duration.class_eval do
def as_json(options = nil)
to_i
end
end
Any better suggestions?
No comments found
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>