Skip to content

Ruby 2.0 regression on sum #26

@JamesHarrison

Description

@JamesHarrison

Not got time to dig into this one but after an update to Ruby 2.0.0-p0, calls like:

@image.views.last_days(7).sum

Throws Mongoid::Tracking::ReaderExtender can't be coerced into Fixnum.

@image.views.last_days(7).map{|v|v.to_f}.sum.to_i

Works as a hacky workaround - #to_i in the map function or #total both fail, to_f seems to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions