request for patch review

Can somebody review the patch attached to ticket #10480?

A has_many through association including the group option doesn't use
the group when counting. Meaning person.grouped_relations.count will
return a different value than person.grouped_relations.length. This
first will construct a query without taking group into account and the
latter will properly fetch all relations and return the length of the
result set.