Reputation: 125
I have a bunch of records that are grouped and I need to sum the columns of all them
When I just to the regular results.sum(:col_name)
it gives me something along the lines of {1 => 2, 2 => 1, 3 => 15}
, but I need (in this example) 18
Upvotes: 0
Views: 17
Reputation: 23671
Just sum the values then
results.sum(:col_name).values.sum
Upvotes: 1