I want to make a app similar to www.imdb.com, now I have a problem to
define the association of two table --people and movies .
Movie stars, movie writers… are allow people, I plan to put all people
data into one table named “people”, and I’ll use “movies” table to store
movies’ information. A movie may have none or more than one movie
writer/ movie star information, and a movie star may show up on several
I want to make association between people table and movies, in such a
way that I can list all movie stars who shown on one movie with
movie.movie_stars, and writers with movie.writers, while
movie.movie_writers << person will add a movie writer info.
Here’s my current idea:
A third table,named “movies_people”, containing movie_id, person_id,
char_type columns, is to be added. char_type column is used to store
person’s role in the movie, like “movie_star” to identify the person is
added as a movie star.
Add methods to Movie.rb, like:
The question is: is that a good idea, or there are better ones?