Subscribe to access all episodes. View plans →

#144: Many to Many Associations with Ecto

Published May 16, 2022

Here we have a list of different albums, with the artist, summary, title, and year it was released. One nice piece of information we are missing though is the music genre of the album. In this episode let’s add a way for us to edit albums to add that. Our genres wont be a field on our albums like these others are. Instead they’ll have their own schema, which means we’ll need to create a way to associate albums and genres.

And to handle this we’ll use Ecto’s many-to-many association. Using a many-to-many association will allow us to …