def sum(key)
      values = values_by_key(key)
      values.inject(0) do |sum, n|
        sum + (n || 0)
      end
    end
def sum(key)
      values = values_by_key(key)
      values.inject(0) do |sum, n|
        sum + (n || 0)
      end
    end
Calculates the sum of values on a given column. The value is returned
 with the same data type of the column, 0 if there's no row.

   Person.sum(:age) # => 4562