2 ActiveRecord Calculations

Hi, I am trying to use active record calculations to perform two

  1. Get the sum for each group.
  2. Of those groups, find the maximum number of that sum

I have the first step done, I just can’t figure out the second step.
Any ideas?

Here is what I have right now:

@total_points = BlahPoint.sum(‘value’, :group => ‘blah_id’)

Then within my view I am calling:


So as you can see, I have total points for each group (blah_id) and now
I am trying to figure out how I can access the group with the most

Thanks in advance.