I have Product class which contains the attribute :quantity to keep
track of how many of those I have in stock.
I have a Order class which has_many Items, and the Item class also has
an attribute :quantity to record how many of a product was ordered.
When an item is added to an order the Item.quantity is specified. This
amount needs to be deducted from the Product.quantity. Not difficult.
When an item is deleted from an order, the Item.quantity needs to be
added to the Product.quantity. Not difficult.
However, How would I go about re-adjusting the Product.quantity when
an item.quantity is CHANGED?
It seems like it should be a trivial thing, but I’m not able to wrap
my brain around it. Thanks for any help.