Emad Shaaban
AEAsh Elixir
•Created by Emad Shaaban on 7/21/2023 in #support
How to insert a record with its nested children?
First, I'd love to thank everyone and especially Zash for the awesome work done in Ash
I have a few resources with some relationships between them, for brevity I'll only copy the relevant parts
What I wish to do is to insert an order along with its lines like this
I could make it using
manage_relationship
, but it seems to require lines to be sent as an argument to the create action and not as a part of the order itself.
I also tried Ash.Resource.Change
like this
elixir
And updated the create action in order resource to be like this
but it doesn't work, and it seems that :lines always get removed from changeset before the change code runs.
Am I missing something?
I don't mind sending lines as an argument to the action in this case, but then what happens with multiple levels of nesting?6 replies