More on n-way

Hey, i found some n-way threads on the list, but I think they dont solve my case, or I didnt understand how all of it works. I’m new to
Rails, so be pacient. :slight_smile:

I’ll use an example of movie catalog, I’m realing doing a kind of
movie catalog, for laerning rails, and I did this:

Models:
Movie, Actor, Director, Writer, Country, Language

The Movie model HABTM Actor, Director and Writer, and belongs_to
Country and Language

@Movie
id
name
country_id
language_id
year

Join tables:
movies_actors
movies_writers
movies_directors

Everything works! But I have a situation where I can have an Actor,
that is ALSO a Director or a *Writer too.
If I update some Actor information, I have to update it on the other
tables (Directors,Writers), if it’s there.

Solution ?

Using database, I solve like this.

@person
id
name
birth

@type
id
name

@movies_people_types
movie_id
person_id
type_id

In this way, I can have the same person working on a movie as a
Director AND as an Actor,
and I just update information in one place, the Person model.

How to put this on Rails ? If theres another way to get in the same
result, I`d appreciate suggetsiont.

PS. Sorry my English, I don’t know this tech english language, correct
me If I’ wrong.

Enderson Maia

ICQ: 8817986
MSN: endersonmaia[arroba]gmail[ponto]com
Linux User: 286130