Ash FrameworkAF
Ash Framework8mo ago
3 replies
zimt28

manage_relationship: Get changes in related records

My Invoice resource has many Items. Every item calculates its total in a change. I want to calculate the sum of those totals in the invoice but cannot find a way to read the full items, only the input. How can I do this?

argument :items, {:array, :map}, allow_nil?: false
change manage_relationship(:items, type: :create)
change fn changeset, _context ->
  # How can I read the final items?
end)
Was this page helpful?