Hello, perhaps this is application specific but it seems as though summing on pages greater than one sums the records incorrectly. Although resolving the query to an array with map and then calling sum over the elements sums correctly.
[1] pry(main)> Trip.paginate(page: 2).sum('distance')
(2.5ms) SELECT SUM("trips"."distance") FROM "trips" LIMIT $1 OFFSET $2 [["LIMIT", 30], ["OFFSET", 30]]
=> 0.0
[2] pry(main)> Trip.paginate(page: 1).sum('distance')
(0.6ms) SELECT SUM("trips"."distance") FROM "trips" LIMIT $1 OFFSET $2 [["LIMIT", 30], ["OFFSET", 0]]
=> 10542.792252
Is this a bug in will_paginate ?
Hello, perhaps this is application specific but it seems as though summing on pages greater than one sums the records incorrectly. Although resolving the query to an array with
mapand then calling sum over the elements sums correctly.Is this a bug in
will_paginate?