Has_many :through and belongs_to


#1

I have a relationship where a Show has_many Techs through People. From
what I understand that requires me to put belongs_to Show in the People
model. My problem is that a Tech can belong to many Shows. Is there
any way of solving this besides putting a has_many Shows relationship in
People


#2

Chris C. wrote:

I have a relationship where a Show has_many Techs through People. From
what I understand that requires me to put belongs_to Show in the People
model. My problem is that a Tech can belong to many Shows. Is there
any way of solving this besides putting a has_many Shows relationship in
People

After reading about these associations I realized I (think) I made an
error when making my domain model. I have a table called shows, a table
called people, a table called techs, and a table called Castmembers.
The people table has all the information about each person. So what I
want is to be able to say @show.techs, and get the people objects for
the techs associated with the show, plus the data in the techs table,
which contains their department and position for the show. The sme sort
for castmembers. I think I need a show has_many people through techs,
and a show has_many people through castmembers. Is this right? Then,
how do I solve the problem above with people being aassociated with
multiple shows?