Trigger a delete on a create action

Hi, I’m learning Ash, reading the Ash Framework book and playing a bit with Ash.

I’ve a table with a bunch of records. Whenever I insert (create) a new record, I’d like to delete some old ones based on some conditions.
What is the idiomatic way to do it?
Is there any resource I can read on more detail about this kind of things?

For this, you’d use action hooks, like after_action. We show hooks in the book, and you can read the actions guide, and the “multi step actions” guide on HexDocs for more information on hooks.