update the example for `after_commit` in the guides.

This is a follow up to #9356.

The original example was quite complicated because it did not specify that the callback should only run on destroy. Therefore a second callback was necessary to set the state.