Displaying 1 result from an estimated 1 matches for "find_all_by_invoice_id".
2009 Apr 01
3
Nil being coerced to float
I was doing this:
@line_items = LineItems.find_all_by_invoice_id(params[:id])
@payments = Payments.find_all_by_invoice_id(params[:id])
@total = @line_items.sum{ |item| item.cost }
@payment_total = @payments.sum{ |payment| payment.value }
@balance = @total - @payment_total
But when no payments had been made it was coming up with an error when...