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, Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 14 October 2010 13:46, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> 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.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. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Walter, On Thu, Oct 14, 2010 at 7:46 AM, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> 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.Seems to me you might benefit from introducing a Team model/controller/view stack to manage the assignment of People and their Roles. Best regards, Bill -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.