This project is archived and is in readonly mode.

#6401 new
Jonathan del Strother

BasicObject causing problems with duration.to_json

Reported by Jonathan del Strother | February 9th, 2011 @ 04:41 PM

Commit 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)

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=""></a>

People watching this ticket