when an order is approved, the food available quantity must be decreased by the number of items ordered by the customer.
The preferred way to do this as of now:
create a method in Order model named approve() which will go to the Order.order_items.food.available_quantity and decrease it.
The reason to do this in Order model after approve is that if the customer's order is denied then no food item is consumed so no item must be decreased.
when an order is approved, the food available quantity must be decreased by the number of items ordered by the customer. The preferred way to do this as of now: create a method in Order model named
approve()
which will go to theOrder.order_items.food.available_quantity
and decrease it. The reason to do this in Order model after approve is that if the customer's order is denied then no food item is consumed so no item must be decreased.