Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

BasicObject causing problems with duration.to_json

#6401

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?

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

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

No comments yet.