Ecto.Changeset.put_change
You're seeing just the function
put_change
, go back to Ecto.Changeset module for more information.
Specs
Puts a change on the given key
with value
.
key
is an atom that represents any field, embed or
association in the changeset. Note the value
is directly
stored in the changeset with no validation whatsoever.
For this reason, this function is meant for working with
data internal to the application.
If the change is already present, it is overridden with the new value. If the change has the same value as in the changeset data, it is not added to the list of changes.
When changing embeds and associations, see put_assoc/4
for a complete reference on the accepted values.
Examples
iex> changeset = change(%Post{author: "bar"}, %{title: "foo"})
iex> changeset = put_change(changeset, :title, "bar")
iex> changeset.changes
%{title: "bar"}
iex> changeset = put_change(changeset, :author, "bar")
iex> changeset.changes
%{title: "bar"}