Hi All.
I’m currently tryinng to get my head around Ash. I’m slowly getting there but still coming across some things that I can’t quite grasp. So my current problem. I have the following update action:
update :update do
accept [:email, :name, :phone]
end
I run the update action with…
customer |> Ash.Changeset.for_update(:update, %{name: "Bert", email: "bert@email.com"}) |> Ash.update
When I try and run :update, Ash kindly points out…
cannot atomically update a record without a primary read action or a configured `atomic_upgrade_with` action
So I have one read action which I update as the primary action and looks like this…
read :read_by_id do
primary? true
argument :id, :integer, allow_nil?: false
filter expr(id == ^arg(:id))
end
The read action requires an id but I’ve no idea how to pass the id when calling the update action.
Any ideas?
P.S. Happy to be told this just isn’t the way things are done in Ash
cheers
Dave