I have a resource with an attribute that is defined as an {:array, :string}
type:
attribute :tags, {:array, :string} do
public? true
allow_nil? false
default []
end
Using Ash.Changeset.change_attribute(changeset, :tags, [])
does not set the array to []
. It seems the tags
column is excluded from the UPDATE query. It returns the resource with the tags column unmodified. If the array is not empty ["test"]
then the entire array is updated as expected.
If I run Ash.Changeset.change_attribute(changeset, :tags, nil)
then I get a postgres non null violation which makes sense.
However, if I run Ash.Changeset.force_change_attribute(changeset, :tags, [])
it will go ahead and set the tags
column to an empty array.
I’m confused why Ash.Changeset.change_attribute(changeset, :tags, [])
doesn’t set the column to an empty array like the force method does.