search for: results_sum

Displaying 1 result from an estimated 1 matches for "results_sum".

2005 Aug 23
10
Creating a simple sum (or: I suck at blocks!)
I''ve been hacking on this for awhile and am not even getting close. Consider the following... results = Sample.find(:all) total_counter = results.each{|result| #Add together result.counter} I just want to simply iterate through the list and sum the counter field for each row into an aggregation. I could do it in a full for loop, but is there a nice one liner I''m missing?