For this homework, you will further refine your team’s web app by adding associations between some of your previously created model classes and by updating your seed data and actions/views to use these associations. Additionally, you will continue to practice with the version-control system, Git.
You will do this homework as a team; however, each member of your team will be responsible for the completion of a particular task.
Each team member will choose one task from the list below to complete. All team members must do a different task. If your team has only three members, then ignore Task 4.
Once everyone has selected their tasks, you must follow the workflow in this instructional video. Follow all the steps carefully, including submitting your team’s work as a GitHub release.
Similar to previous homeworks, there will be four tasks (Tasks 1 through 4); however, this time the tasks are more inter-related. Each task will have the same four parts:
Implement two model associations, as shown in the following figure (as discussed in this demo). In particular, you must create the associations labeled with your task number. Your Rails model associations must match the class diagram exactly—including the role names on the association ends. Furthermore, each association declaration must include class_name, foreign_key, and inverse_of arguments (see the Rails Guides for documentation).

Additionally, you must follow these task-specific instructions:
TeachingEvaluation class, add an optional: true argument to the belongs_to declaration for the Teacher object, so TeachingEvaluation objects can be created without associated Teacher objects.ClassSection class, add an optional: true argument to the belongs_to declaration for the Teacher object, so ClassSection objects can be created without associated Teacher objects.Student class, add an optional: true argument to the belongs_to declaration for the ClassSection object, so Student objects can be created without associated ClassSection objects.HomeworkSubmission class, add an optional: true argument to the belongs_to declarations for the HomeworkGradeSheet and the HomeworkSpec objects, so HomeworkSubmission objects can be created without associated HomeworkGradeSheet and the HomeworkSpec objects.Update the seed data as follows. For each new model association, your seed data must contain at least 5 instances of the associations (i.e., links). Furthermore, for each one-to-many association, at least 3 of the association links must be associated with the same model object (i.e., from the “one” side of the association). You may reuse your existing seed objects or create additional seed objects to meet these requirements.
In creating these association links, you may need to coordinate with your teammates. For example, for model classes with multiple associations to other classes, possibly from different tasks, it makes sense that two teammates would each add the association links for their task to the same shared set of seed objects.
Using your newly created associations, you must update the model CRUD pages as follows. The specific parent and child model classes for each task appear further down.
Update the parent show page such that it includes a table listing all the child objects that the parent object has. The table must be inserted below the usual parent show info and be styled like the table in the child index page.
Update the child index page such that a new column is added to the table. The column must be titled col-heading, and it must display the parent-attr attribute of the parent object to which the child belongs. All CRUD links must be removed from the index page (i.e., the create, show, update, and destroy links). Each parent name must hyperlink to the associated parent object’s show page.
Update the child show page such that it now lists the parent-attr attribute of the parent object that the child object belongs to. The name must hyperlink to the associated parent object’s show page. The “Back” and “Update” links must be removed from the child show page.
The parent edit form must now include the equivalent of an index page for child (including all the usual CRUD links found on the index page). The CRUD child functionality must now all be specific to a particular owner. For example, if a user on the parent edit form click the “Create Property” link, then the child new form must be creating a child that belongs to the parent. Successful submission of the form must redirect the user to the associated parent object’s show page. Similarly, successful updating or destroying of a child object must also redirect to the associated parent object’s show page.
Here are the per-task mappings:
SchoolTeachernameClassSectionStudentlocationStudentHomeworkSubmissionlast_nameHomeworkSpecHomeworkSubmissiontitleUpdate your project’s home page so that it now lists your name (no hyperlink) followed by the following two links:
School index page.Teacher index page.TeachingEvaluation index page.ClassSection index page.Student index page.HomeworkSubmission index page.HomeworkGradeSheet index page.HomeworkSpec index page.Total points: 100
Below, the top-level number is the items total point value. If an item is not submitted at all or it is irredeemably broken, 0 points will be awarded for that item. The sub-bullets indicate standard deductions for errors in a submitted item. The deduction list below may not be complete because there may be mistakes that we did not expect. The deduction for an unexpected mistake will be assessed at the time it’s discovered and will reflect how severe the instructor thinks the mistake is.
40 Two model associations (20 each)
show page with new tableindex page with new columnshow pageedit page and child CRUD actionsOther deductions: