The second reason this is interesting is because of callbacks that are associated with these two methods. A callback hook like after_save is actually part of the same active transaction that was opened when we called @user.save. So, if we wanted our code to execute outside of Rails’ default transaction that wraps around save or destroy, we’d want to use callback hooks like after_commit or after_destroy. If we want something specific to happen when the save transaction succeeds, we’d have to use the after_commit callback, and if we want something specific to happen when the save transaction fails, we could use the after_rollback hook.
Rails transaction callbacks done right