search for: blah_id

Displaying 2 results from an estimated 2 matches for "blah_id".

Did you mean: bar_id
2006 Jun 03
6
Calculating row COUNTs
hi everyone, I''m trying to do a simple calculation in my rails project. I would like to find all rows in a table that match the given id of another table (ie. comment_id) and has the value = 1 ("value" is a field in the table), then add those values up. Next find the same rows with the value = -1 and add those values up also. Finally, I would like to find the total.
2006 Jul 09
0
2 ActiveRecord Calculations
...tions. 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: @total_points[blah.id] 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 points. Thanks in advance. -- Posted via http://www.ruby-forum.com/.