Change
inject(0) { |sum,count| sum, count }
to
inject(0) { |sum,p| sum + p['count'] }
Isolate the code
If you're having trouble integrating this, copy and paste these 2 lines into an irb
session to verify this works:
a = [{'count' => 1},{'count' => 2},{'count' => 3}]
a.inject(0) { |sum,p| sum + p['count'] }
# => 6
Hopefully this helps bridge the gap.