Search⌘ K
AI Features

Work with Associations

Explore how to update and insert associated records in Ecto with changesets and build_assoc. Understand when to modify individual child records directly versus updating collections, and learn how to insert new associations using Repo in Elixir.

So far, all of our changesets have used a single schema. However, we’ll often need to update associated records as well as parent records at the same time. Ecto provides several options for updating associated records, each serving a particular purpose depending on where our data is coming from and how we want it updated. This section ...