class Invoice < ApplicationRecord belongs_to :user belongs_to :user_firm belongs_to :customer has_many :invoice_products, inverse_of: :invoice accepts_nested_attributes_for :invoice_products, allow_destroy: true def netto_amount 0.0 end end