0
[#<ActiveRecord::Associations::CollectionProxy [#<InvoiceServiceType id: 1, value_charged: 50.0, invoice_id: 4, service_type_id: 1>, #<InvoiceServiceType id: 2, value_charged: 50.4, invoice_id: 4, service_type_id: 2>]>, #<ActiveRecord::Associations::CollectionProxy [#<InvoiceServiceType id: 8, value_charged: 70.0, invoice_id: 1, service_type_id: 2>, #<InvoiceServiceType id: 9, value_charged: 50.0, invoice_id: 1, service_type_id: 6>]>]
我想總結所有value_charged。如何獲得這個ActiveRecord :: Associations :: CollectionProxy的總和?
IM嘗試地圖(&:value_charged)的.sum 收集.. 並沒有什麼:(
謝謝
你有什麼錯誤?顯示你的代碼。 – coreyward