This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/models/p_product_cat.rb
2021-08-23 10:26:02 +02:00

15 lines
337 B
Ruby

class PProductCat < ApplicationRecord
has_many :p_products
has_many :p_product_refs, :through => :p_products
has_many :tvable_tva_rates, :as => :tvable
has_many :tva_rates, :through => :tvable_tva_rates
before_save :update_stocked
def update_stocked
self.p_product_refs.update_all(:stocked => self.stocked)
end
end