Probably a super easy solution, but trying to figure out how to find the sum of the ‘amount’ integer columns that belong to:
@milestones = Milestone.where(:buyer_id => current_user.id).where(:status => 'Paid')
I tried <%= @milestones.amount.inject(:+) %> in the view, didn’t work.
Of course, it didn’t work. There’s no
amounton array ofMilestones. Try this: