AE
Ash Elixir•3y ago
Blibs

Transaction between separated actions

I believe I already have the answer for that, but I just want to double check if that is the best/correct way to do it with Ash. If I have two actions, say, User.add!() and Marketing.add!() and want to run them inside the same transaction, should I just do this?
Repo.transaction(fn ->
User.add!(args)
Marketing.add!(args)
end)
Repo.transaction(fn ->
User.add!(args)
Marketing.add!(args)
end)
1 Reply
ZachDaniel
ZachDaniel•3y ago
That is one way to do it, yes 🙂

Did you find this page helpful?