Software Engineering

Homework 7: MVC Model Associations

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.

The Tasks

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:

  1. Add two model associations.
  2. Add seed data that uses the associations.
  3. Update views/controllers to make use of the associations.
  4. Update the home page to link to your newly created pages.

Add Two Model Associations

Implement two one-to-many associations, as shown in the following figure. 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 has_many/belongs_to declaration must include class_name, foreign_key, and inverse_of arguments (see the Rails Guides for documentation).

alt text

Additionally, you must follow these task-specific instructions:

Update Seed Data

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, 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.

Update CRUD Views/Controllers

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.

Here are the per-task mappings:

Update the Home Page

Update your project’s home page so that it now lists your name (no hyperlink) followed by the following two links:

How to submit your team’s work

Before you can submit, all team members must have merged their code into the master branch and pushed the updates to GitHub. If a team member does not complete his/her work on time, you may submit without his/her contribution.

To submit your team’s work, you must “tag” the current commit in the master branch:

To grade your work, I will check out the appropriate tag, and run it on my machine.

Note that if for some reason you need to update your submission, simply repeat the tagging process, but increment the version number (e.g., hw7v2, hw7v3, hw7v4, etc.).

Rubric

Total marks: 100

Below, the top-level number is the items total point value. If an item is not submitted at all, 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.

Other deductions:

© Scott D. Fleming 2018 • Made with GitHub Pages and Markdown