I have database tables: Users, Projects and Stages and a linking table ProToStg. When creating a new project the number of stages associated with the project is determined by the User’s group and each group can use any number of stages in their projects, generally between 2 and 5 stages. Now here Stages are simply defined periods of time the project goes through in its life cycle and the time spent in each stage is of importance.
When creating a new project the number of stage to display for input varies based on the group id of the user and I do not know how to get this variable number of stage into the model/view without creating new models/views for each number of possible stages, my current solution.
A variable number of fields that need to input from the user. The controller needs to be able to grab the user’s group, refer to the Stages table and see that this group uses N number of stages and then present a form for gathering the project information as well as the information on the N stages defined in the Stages table for this group.
Things I know how to do:
In the controller I can grab the group ID of the user and present then with a model/view for entering in a new project details with the appropriate number of stages. Currently I have two model/views for entering new projects, one model/view for new projects with two stages and another model/view for new projects with three stages. I would like to be able to call one Model/view but the ability to grab input for 2, 3, 5 or N number of different stages. This is what I am having trouble solving.