Why does this fail:
%Partner{} |> cast(%{id: 123}, [:id]) |> delete
with a Ecto.NoPrimaryKeyValueError? I'm setting the primary key explicitly?
Why does this fail:
%Partner{} |> cast(%{id: 123}, [:id]) |> delete
with a Ecto.NoPrimaryKeyValueError? I'm setting the primary key explicitly?
Copyright © 2021 Jogjafile Inc.
For changesets, the
idfrom the original struct (data) is used byRepo.delete, and not the one inchanges, andcastputs the newidonly inchanges. You can either mergechangesinto the original struct (data):or put the
idinto%Partner{}manually: