views:

34

answers:

1

Hello all -

Right now, I'm in the middle of actually building a Project Management application, and I'm kind-of stuck on the way i should build this form. At the moment of adding a project I would like to select the clients that would be included in the project. Here's the code to a few things of interest:

Project Model Project Migration Clients Model Clients Migration Clients_Projects Migration table

http://pastebin.com/280MjR8i

What would be the best approach on building the Controller/View so far, i have this for the view, but i have no idea, what should be the take on the controller ->

http://pastebin.com/dHa8nAQZ

+2  A: 

I would use nested attributes for this. Check out Ryan Bates' railscast http://railscasts.com/episodes/196-nested-model-form-part-1 and http://railscasts.com/episodes/197-nested-model-form-part-2.

You can add and remove clients for a project using this method. Using a list of checkboxes to select clients could be problematic for a large number of clients.

John Drummond
Thanks a lot, those screencasts saved my life :)
Gotjosh