
Aggregates broken w/ :limit
Reported by Gary Yngve | December 9th, 2008 @ 01:42 PM
see attached script. this is a big deal because .size will break for merb folks doing pagination.
Comments and changes to this ticket
-
Dan Kubb (dkubb) December 9th, 2008 @ 02:52 PM
- State changed from unconfirmed to accepted
Can you give dm-aggregates in edge a try? I removed the code where Collection#size is aliased to #count, so it should work the same as Array#size again.
-
Gary Yngve December 9th, 2008 @ 04:48 PM
You need to comment out def size in Model too. The prob is that Collection can hit method-missing and then bounce to Model's size.
That would be a sufficient fix for now, as it addresses the most common/ignorant uses.
The aggregates as a whole (sum,min,avg..) are still broken when limit is used.. like if i want a query of the average of the top 10 records sorted by whatever.
-
Dan Kubb (dkubb) December 10th, 2008 @ 08:49 PM
- State changed from accepted to resolved
Gary, I've updated dm-aggregates so that Model#size doesn't delegate to count either.
At some point I'd like to explore this again, once we work out all the conditions, but for now I think commenting it out is the best approach.
If you're interested in figuring this out though, I'd love to see someone take it on. I think in alot of cases, where the Collection doesn't get loaded, that using count could really speed things up.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »