What are our Nested Routes? (We need a nested new route and either a nested index or nested show route)
# table migration for: examples
# t.string :name
# t.string :etc…
class Example
# relationships
# validations
# user submittable attributes (if this is a join model)
# scope_methods (if any)
end
Project Examples to flesh out:
- Doctor, Patient and Appointment
- User, Project, Task
- Project, Programmer, Assignment
- Recipe, Ingredient, RecipeIngredient
- User, Exercise, ExerciseLog
- User, Topic, Interest
- User, Medication, Prescription
- User, Movie, Review
- Dancer, DanceClass, Enrollments
- Character, Motivation, Alignment
What is the Many to many relationship and how is it used?
Student <=> Allergy
Always 6 Macros:
Users can view the students associated with a teacher.
Teachers can see all of their students' allergies (with severity)
Teachers can see all of the students that have a particular allergy (/allergies/:allergy_id/students => all of the students that have that allergy)
What is the User Submittable attribute on the join model?
StudentTeacher has year, and/or StudentAllergy has severity
What Validations do we need?
see below
How do users fit into the application? How are they related to the other models?
User is a teacher who logs in and adds students to their class and also their allergies.
What are our Nested Routes? (We need a nested new route and either a nested index or nested show route)
/teachers/:teacher_id/students => list of students who have teacher_id of params[:teacher_id]
/students/:student_id/student_allergies => student_allergies index with severity for particular student with id of params[:student_id]
/students/:student_id/student_allergies/new => form to add a student allergy for the student with id params[:student_id] (form comes prefilled with student need to select allergy and fill in severity)
Do we have Non Nested Versions of those nested routes?
/student_allergies/new => form to add an allergy to a student (need to select both student and allergy
What Scope Method(s) do we have and how are they used?
Allergy.severe => all severe allergies
teachers.allergies.severe => All
What does the schema for our app look like?