How to do I save belongs_to relationship?
I have Item and UnitMeasure resource. Item resource belongs to the UnitMeasure Resource.
Here is the relationship definition for the Item resource:
relationships do belongs_to :unit_measure, Kamaro.Stock.UnitMeasure do attribute_writable? true end end According to Ash Relationship Tutorial, the following code should work
item |> Ash.Changeset.for_update(:update, %{unit_measure_id: unit.id}) |> Ash.update() But it is giving me an error that:
{:error, %Ash.Error.framework{ errors: [ %Ash.Error.Framework.MustBeAtomic{ resource: Kamaro.Stock.Item, action: :update, reason: "Ash.Resource.Change.ManageRelationship does not implement `atomic/3`", splode: Ash.Error, bread_crumbs: [], vars: [], path: [], stacktrace: #Splode.Stacktrace<>, class: :framework } ] }}