で動作するこのコードがありますshipment has one invoice
が、今はに変更する必要がありましたshipment has many invoices
。新しい関連付けを反映するように次のコードを変更するにはどうすればよいですか?
@totals = {
:overall => @shipments.reduce(0) { |total, shipment| total + shipment.invoice.customer_total },
:paid => @shipments.reduce(0) { |total, shipment| total + shipment.invoice.customer_amount_paid },
:balance => @shipments.reduce(0) { |total, shipment| total + shipment.invoice.customer_open_balance }
}