drnic/composite_primary_keys — pull request #107 by codeodor (2012-05-19 19:38:20+00:00)
Title: Pull Request #99 had a bug when selecting distinct on a column

I noticed the tests for distinct count weren't really testing anything (since by default it was counting on the composite PK, which would be distinct anyway), so I added some tests to actually count distinct and not distinct rows.

That lead me to find that Pull Request #99 had a bug if you specified a single column to count on, my code there assumed it would be a String, but it could be an Arel Attribute too, so it raised an exception.

Anyway, then I realized we could just remove the special-case code in favor of calling Rails' version of the method, unless CPK needed to deal with the count specifically because an Array was the parameter.

All tests pass on mysql and postgresql.