Forum: Ruby on Rails HABTM relationship with two join tables

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
96931bfe0c2948f47a98e15ae52e5637?d=identicon&s=25 Chris Carter (cdcarter)
on 2006-04-17 02:11
Ok, I have a People table, a Shows table, a Techs table, and a
Castmembers table.  The people table has contact info about each person,
the techs and castmembers tables have information about the persons
specific role in that sshow.  i want to call @show.techs (or somethign
equivelent, I don't want to start that code yet) and get all the techs
associated with the show, and the information stored in the people
table, and the role info in the techs table.  also, a person can be a
tech or castmember for more than one show, with different role
information for each show, any idea how to do this?  Should it be a
HABTM, or a has_many :through?  Code examples very welcome
3bdb0e723531e44040fe7131f723ef0b?d=identicon&s=25 Mark Paxton (mpaxton)
on 2006-04-17 04:26
Chris Carter wrote:
> Ok, I have a People table, a Shows table, a Techs table, and a
> Castmembers table.  The people table has contact info about each person,
> the techs and castmembers tables have information about the persons
> specific role in that sshow.  i want to call @show.techs (or somethign
> equivelent, I don't want to start that code yet) and get all the techs
> associated with the show, and the information stored in the people
> table, and the role info in the techs table.  also, a person can be a
> tech or castmember for more than one show, with different role
> information for each show, any idea how to do this?  Should it be a
> HABTM, or a has_many :through?  Code examples very welcome

For all who are interested we have a chat on IRC and came up with this:
http://rafb.net/paste/results/mfYceo71.html

Always welcome for people to make corrections / improvments :)

Cheers,
Mark
This topic is locked and can not be replied to.