update the example for `after_commit` in the guides.

This is a follow up to #9356.
Merge pull request #9402 from senny/9356_update_guides

update the example for `after_commit` in the guides.