cmgtech
asked on
Ruby on Rails: Dealing with many-to-many relationships in one view
Hello,
I am creating an application to learn Rails and I've come to a point that I really can;t find any help on.
I have a many-to-many relationship between SHOW and ARTIST associated by APPEARANCE.
I have it all set up to Create SHOWs, ARTISTs, and then join them with APPEARANCEs (scaffolding-style), but as a workflow it doesn't seem like it would fly in actual practice.
While creating a SHOW, I'd like to also be able to add as many APPEARANCES as I want (we'll say 3 here to simplify it). So I imagine the view looking like:
1) All the NEW SHOW information
2) 3 dropdown controls populated by ARTISTS
---When this screen is finally saved, the Create method should create the appropriate APPEARANCE records.
On my own after this works, I'm hoping that I'll be able to apply the same technique to create new ARTIST records from the NEW SHOW view. But again, if I get some help just with the part above, I should be able to figure it out from there... although I am feeling really incompetent right now.
Any help or insight will be greatly appreciated.
Thanks,
Mark
I am creating an application to learn Rails and I've come to a point that I really can;t find any help on.
I have a many-to-many relationship between SHOW and ARTIST associated by APPEARANCE.
I have it all set up to Create SHOWs, ARTISTs, and then join them with APPEARANCEs (scaffolding-style), but as a workflow it doesn't seem like it would fly in actual practice.
While creating a SHOW, I'd like to also be able to add as many APPEARANCES as I want (we'll say 3 here to simplify it). So I imagine the view looking like:
1) All the NEW SHOW information
2) 3 dropdown controls populated by ARTISTS
---When this screen is finally saved, the Create method should create the appropriate APPEARANCE records.
On my own after this works, I'm hoping that I'll be able to apply the same technique to create new ARTIST records from the NEW SHOW view. But again, if I get some help just with the part above, I should be able to figure it out from there... although I am feeling really incompetent right now.
Any help or insight will be greatly appreciated.
Thanks,
Mark
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah, I was surprised at how hard it was to find documentation on it.
Your solution worked out for me though, thanks for answering such a stale question.
Thanks,
Mark
Your solution worked out for me though, thanks for answering such a stale question.
Thanks,
Mark
welcome
ASKER
http://railscasts.com/episodes/73 -part 1
http://railscasts.com/episodes/74 -part 2
http://railscasts.com/episodes/75 -part 3
Thanks,
Mark