So far we’ve made an app that stores data using two models. We used the
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.
Create a new app named
Install the gems.
Run the local server and visit