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
User, Exercise, ExerciseLog
What is the Many to many relationship and how is it used?
User has_many Exercises
Exercise has_many Users
ExerciseLog belongs_to Users and Exercises
users/:user_id/exercises
exercises/:exercise_id/users
What is the User Submittable attribute on the join model?
Sets and Reps
Duration
Time (optional)
What Validations do we need?
User
Exercise
ExerciseLog
How do users fit into the application? How are they related to the other models?
User is the one logging exercises. In this case, Users will only see their own exercise logs.
What are our Nested Routes? (We need a nested new route and either a nested index or nested show route)
exercises/:exercise_id/exerciselogs -> all of the logs the currently logged in user has made for that particular exercise
Do we have Non Nested Versions of those nested routes?
exerciselogs/new -> might be useful if the app is for a trainer, they can log exercises for their clients
exercises/new
exerciselogs
What Scope Method(s) do we have and how are they used?
how many users did an exercise
ExerciseLog.how_many_users(:exercise_id) => number of users
Exercise.total(:exercise_id) => if duration, time or if sets/reps, how many reps
IF exercise has a category, then Exercise.type(:category) => HIIT, cardio, yoga, dance, barre, weight lifting, etc.
What does the schema for our app look like?
Thanks Rumiko and Mitzi :)