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.
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 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.
Add seed data as follows. You must have at least three records from the “one” side of each of your associations, and each of those records must be associated with at least two records from the “many” side of the association. Thus, for a given association, there will need to be a minimum of 9 records (3 from the one side + 2 + 2 + 2 from the many side).
In creating the seed data, you may need to coordinate with your teammates to come up with sensible data given their constraints. To keep the total number of seed objects manageable, it is OK for you to “share” model objects with teammates in the seeds file. That is, you may count the same model object toward the objects required for multiple associations.
Using your newly created associations, you must update views/controllers as per the task-specific requirements below:
Update the Owner
show
page such that it includes a table listing all the Bar
objects that the Owner
object has. The table should be inserted below the usual Owner
show
info and be styled like the table in the Bar
index
page.
Update the Bar
index
page such that a new column is added to the table. The column should be titled “Owner”, and it should display the name
attribute of the Owner
object to which the Bar
belongs.
The Bar
new
/create
and edit
/update
pages should now include a dropdown field (collection_select
) that allows the user to select the Owner
object to which the Bar
object will belong. The text for each item in the dropdown should be the name attribute of the Owner
. In the edit
form, the dropdown field should select the Bar
’s current Owner
by default.
Update the Bartender
show
page such that it includes a table listing all the Recipe
objects that the Bartender
object has. The table should be inserted below the usual Bartender
show
info and be styled like the table in the Recipe
index
page.
Update the Recipe
index
page such that a new column is added to the table. The column should be titled “Bartender”, and it should display the name
attribute of the Bartender
object to which the Recipe
belongs.
The Recipe
new
/create
and edit
/update
pages should now include a dropdown field (collection_select
) that allows the user to select the Bartender
object to which the Recipe
object will belong. The text for each item in the dropdown should be the name
attribute of the Bartender
. In the edit
form, the dropdown field should select the Recipe
’s current Bartender
by default.
Update the Supplier
show
page such that it includes a table listing all the Alcohol
objects that the Supplier
object has. The table should be inserted below the usual Supplier
show
info and be styled like the table in the Alcohol
index
page.
Update the Alcohol
index
page such that a new column is added to the table. The column should be titled “Supplier”, and it should display the name
and url
attributes of the Supplier
object to which the Alcohol
belongs.
The Alcohol
new
/create
and edit
/update
pages should now include a dropdown field (collection_select
) that allows the user to select the Supplier
object to which the Alcohol
object will belong. The text for each item in the dropdown should be the name
attribute of the Supplier
. In the edit
form, the dropdown field should select the Alcohol
’s current Supplier
by default.
Update the Country
show
page such that it includes a table listing all the Maker
objects that the Country
object has. The table should be inserted below the usual Country
show
info and be styled like the table in the Maker
index
page.
Update the Maker
index
page such that a new column is added to the table. The column should be titled “Country”, and it should display the name
attribute of the Country
object to which the Maker
belongs.
The Maker
new
/create
and edit
/update
pages should now include a dropdown field (collection_select
) that allows the user to select the Country
object to which the Maker
object will belong. The text for each item in the dropdown should be the name
attribute of the Country
. In the edit
form, the dropdown field should select the Maker
’s current Country
by default.
Update your project’s home page so that it now lists your name (no hyperlink) followed by the following two links:
Owner
index
page.Bar
index
page.Bartender
index
page.Recipe
index
page.Supplier
index
page.Alcohol
index
page.Maker
index
page.Country
index
page.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:
git tag -a hw6v1 -m 'Tagged Homework 6 submission (version 1)'
git push origin --tags
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., hw6v2
, hw6v3
, hw6v4
, etc.).
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.
show
page: -6show
page: -1 to -6 per mistake, depending on severity (max -6 per table)index
page: -4index
page: -1 to -4 per mistake, depending on severitynew
/create
and edit
/update
pages: -8new
/create
and edit
/update
pages: -1 to -4 per mistake, depending on severity (max -4 per dropdown)index
page: -5 eachindex
page: -1 to -5 per mistake, depending on severity (max -5 per hyperlink)Other deductions: