Comments requested

Hi all,

I submitted a patch a couple of days ago that makes it possible to
group on multiple fields when using AR calculations (http://
dev.rubyonrails.org/ticket/10771)

Given this table for a Sample model:

id year month value
1 2007 3 1
2 2007 3 2
3 2007 4 4
4 2007 4 10
5 2007 5 12
6 2007 5 3
7 2007 5 1
8 2008 1 3

Sample.count(:id, :group => [:year, :month]) and
Sample.count(:id, :group => 'year, month') currently fail. The patch
makes both work, returning a nested structure like this:
[[ 2007, [[3,2], [4,2], [5,3]] ], [ 2008, [[1,1]]]]

(the order of nesting is controller by the order of the fields in the
group param, of course).

I'd love feedback on the implementation.

Thanks!
Ben

This seems so obvious that I gotta believe its somewhere in the code
already.

If it is not, a definite +1 for the idea and I will try to test your
code.

I like the idea, but might suggest returning nested hashes instead. I
find them easier to work with. Is that doable? Something like:

[ 2007 => { 3=>2, 4=>2, 5=> 3 }, 2008 => { 1=>1 } ]

Just a thought.

Jeff