foo
|> Repo.preload(:bar)
|> Foo.changeset(attrs)
|> Changeset.put_change(:a_field_name, "a value")
|> Changeset.put_assoc(:bar, %{another_field_name: "another value"})
If I want to add another change into foo’s changeset, I can call put_change/3
again.
But how should I add other changes into the association’s changeset (bar’s changeset)?
Of course I can simply add another entry into the map passed to put_assoc/4
above, but the question is, how can I do that as a separate/subsequent call (e.g. the changeset above is passed to another function that wants to add changes to the association’s changeset).
Thank you for any help