Using ActiveRecord, is there a way to get the old values of a record during after_update
问题 Setup using a simple example: I've got 1 table ( Totals ) that holds the sum of the amount column of each record in a second table ( Things ). When a thing.amount gets updated, I'd like to simply add the difference between the old value and the new value to total.sum . Right now I'm subtracting self.amount during before_update and adding self.amount during after_update . This places WAY too much trust in the update succeeding. Constraint: I don't want to simply recalculate the sum of all the