datamapper / dm-aggregates

DataMapper plugin providing support for aggregates on collections
http://datamapper.org/
MIT License
16 stars 15 forks source link

count method included in resource without dm-aggregates #6

Open solnic opened 13 years ago

solnic commented 13 years ago

It's confusing that the count method is included on a resource without dm-aggregates being included. What's more confusing is it appears to return the proper count when no query hash is specified but otherwise will always return 0.


Created by Alex - 2010-08-10 17:09:31 UTC

Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1384

solnic commented 13 years ago

I think #count is coming from Enumerable in 1.8.7+, but to avoid confusion we should probably use undef_method :count in Model and Collection.

We should probably also look at doing the same for :min, :max and other methods that are provided by dm-aggregates. I would’ve wished that we didn’t have knowledge of which dm-aggregates’ methods are in dm-core, since I think that screws up the dependency chain, but I don’t know if we can get around it.

by Dan Kubb (dkubb)