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.

On Jan 13, 1:42 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to