Ruby on Rails: Dealing with many-to-many relationships in one view
Posted on 2007-10-19
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.