I have a 2 mysql tables called bin
and bundle
. bin
HAS_MANY bundle
s and bundle
BELONGS_TO bin
bin
has a column called binValue
which is the SUM(bundle
.quantityOnHandPrice
) where bundle
.binId
=bin
.id
and it needs to get updated after a bundle
record is deleted.
I'll do the update in the afterDelete model function using some SQL statement, but is there a better OR easier way of doing the update with AR and MySQL Cascading instead of writing SQL update statements?