Class: Spina::Shop::DeallocateStock
- Inherits:
-
Object
- Object
- Spina::Shop::DeallocateStock
- Defined in:
- app/services/spina/shop/deallocate_stock.rb
Instance Method Summary collapse
- #deallocate ⇒ Object
-
#initialize(order) ⇒ DeallocateStock
constructor
A new instance of DeallocateStock.
Constructor Details
#initialize(order) ⇒ DeallocateStock
Returns a new instance of DeallocateStock.
4 5 6 |
# File 'app/services/spina/shop/deallocate_stock.rb', line 4 def initialize(order) @order = order end |
Instance Method Details
#deallocate ⇒ Object
8 9 10 11 12 13 14 |
# File 'app/services/spina/shop/deallocate_stock.rb', line 8 def deallocate # Delete StockLevelAdjustments StockLevelAdjustment.where(order_item: @order.order_items).delete_all # Cache all products involved @order.products.each(&:cache_stock_level) end |