docs: small tweak to lifecycle example

This commit is contained in:
Zach Daniel 2023-11-17 03:23:52 -05:00
parent d738e56fac
commit 1cb544ddfa

View file

@ -114,12 +114,12 @@ defmodule AshChangesetLifeCycleExample do
end)
# execute code before the transaction is started. Use for things like external calls
|> Changeset.before_transaction(fn changeset -> changeset end)
# execute code in the transaction, before the data layer is called
|> Changeset.before_action(fn changeset -> changeset end)
# execute code in the transaction, before and after the data layer is called
|> Changeset.around_action(fn changeset, callback ->
callback.(changeset)
end)
# execute code in the transaction, before the data layer is called
|> Changeset.before_action(fn changeset -> changeset end)
# execute code in the transaction, after the data layer is called, only if the action is successful
|> Changeset.after_action(fn changeset, result -> {:ok, result} end)
# execute code after the transaction, both in success and error cases