So, the answer above might work, but what if I wanted to get the previous value for some reason and use it to accomplish some task, then you would need to get the previous value. In my case, I used this
after_update do if self.quantity_changed? sku.decrement(:remaining, (self.quantity_was - self.quantity) * sku.quantity) end end
_was and _changed? added to any of the columns will complete the task to complete the task.
source share