Nested form, perhaps?

I have a general design question, and haven't written any code for this feature yet. I'm setting up a control panel for a sort of team/content management system. A new project needs a team to work on it. The project has been saved, so we don't have to worry about that. But each member of the team needs to have a role in relation to this project (they may have another role on a different project). So I am thinking about using a has_many_through relationship between projects and people using a Role model.

An admin comes to a new screen to set up the team for this project. She sees a list of all available people in the system, and can check one or more of them to be added to the team. In each chosen person's form row, she also needs to pick a role for that person from a select or radio field.

So my question is this: Which model needs to draw this interface? I am thinking this is coming from the Project, which is iterating over a list of Person.all and accepts_nested_attributes for Roles within each instance of that list.

Any other ideas about this?

Thanks in advance,


The first point is that it is not models that draw interfaces it is
controllers via views. Note that there does not need to be a one to
one relationship between models and controllers. Since you said that
the admin sees a list of available people, perhaps it should be in the
people controller. Perhaps you would be better off with an admin
controller. It is impossible to say from here. I would advise going
with whichever seems most logical to you. Make sure you write tests
first and later if you decide it would be better in a different
controller it is easy to move it. The tests will give you confidence
that you have not messed anything up whilst refactoring.


Hi Walter,