Map Reduce
This is based on an example I saw while watching the Aaron Patterson Play by Play from Peepcode. The syntax is really nice.
records = [
{ :id => 1, :score => 1 },
{ :id => 2, :score => 4 },
{ :id => 3, :score => 9 }
]
records.map { |record| record[:score] }.reduce(:+) # => 14
This will work will an collection such as an Array of ActiveRecord objects.