Module: SpreeCmCommissioner::StockItemDecorator

Defined in:
app/models/spree_cm_commissioner/stock_item_decorator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



3
4
5
6
# File 'app/models/spree_cm_commissioner/stock_item_decorator.rb', line 3

def self.prepended(base)
  base.has_one :vendor, through: :variant
  base.after_save :update_vendor_total_inventory, if: :saved_change_to_count_on_hand?
end

Instance Method Details

#update_vendor_total_inventoryObject



8
9
10
# File 'app/models/spree_cm_commissioner/stock_item_decorator.rb', line 8

def update_vendor_total_inventory
  SpreeCmCommissioner::VendorJob.perform_later(vendor.id) if vendor.present?
end