Associations II

Many to Many

So far we've made an app that stores data using two models. We used the has_many / belongs_to association to model a one-to-many relationship between the data.

But not all data is one-to-many. For example, a movie has many actors in the cast, but each actor also has many movies she's starred in.

To model this data, we need a many-to-many relationship. Let's see how to do this by building a Rails app for a movie website.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.