datamapper / dm-aggregates

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

Incorrect query when counting has n, :through relationships. #17

Open postmodern opened 12 years ago

postmodern commented 12 years ago

I've reproduced a bug where dm-aggregates would not generate a GROUP BY clause to remove duplicate entries when counting a has n, :through relationship, thus resulting in inflated numbers.

git clone https://github.com/postmodern/dm-bug-report.git -b relationship_count
cd dm-bug-report/
bundle install
ruby bug.rb
DEBUG=true ruby bug.rb
postmodern commented 12 years ago

@dkubb is working on a patch for this (https://gist.github.com/67bb96fec0fbae59e505) and will likely be included in the 1.3.0 release.