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 (
Totals
amount
Idea 1: Wrap the update in a database transaction, so that if the update fails your Totals table isn't changed: ActiveRecord Transactions docs
Idea 2: Stash the old value in @old_total during the before_update.