olwen_demo_app/app/models/p_ship_bill.rb
Nicolas Bally 7b2e6811dd initial
2020-06-05 11:10:02 +02:00

18 lines
312 B
Ruby

class PShipBill < ApplicationRecord
belongs_to :p_fournisseur
has_many :p_ship_bill_lines
accepts_nested_attributes_for :p_ship_bill_lines
before_save do
self.a_ok_total = 0.0
self.p_ship_bill_lines.each do |psbl|
self.a_ok_total += psbl.a_ok_total
end
end
end