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, Project, Task
What is the Many to many relationship and how is it used?
User <=> Project (through task)
many to many always requires 6 macros:
We'll have a view that can display all of the projects a user has been assigned tasks for.
We'll also have a view that can display all of the users who have been assigned tasks for a project.
What is the User Submittable attribute on the join model?
Tasks have Description and Status
What Validations do we need?
see below
How do users fit into the application? How are they related to the other models?
Users are in domain so that's a little bit more self explanatory here. Users are able to create tasks and projects and (maybe?) see other user's tasks that are related to projects they're also involved in.
What are our Nested Routes? (We need a nested new route and either a nested index or nested show route)
/users/:user_id/tasks/new => form to add a task assigned to a particular user (the one with the params[:user_id]) and you would select the project to assign it to.
/users/:user_id/tasks => a list of tasks that belong to that user
/projects/:project_id/tasks/new => form to add a task assigned to a particular project (the one with the params[:project_id]) and you would select the user to assign it to.
/projects/:project_id/tasks => a list of tasks that belong to that project
/projects/:project_id/users/:user_id/tasks => Shows a list of all a particular user's tasks on a particular project
Do we have Non Nested Versions of those nested routes?
/tasks => a list of all of the tasks assigned to the current user
/tasks/new => a form that allows you to create a task and select both the project and the user to assign it to.
What Scope Method(s) do we have and how are they used?
Task.incomplete => returns tasks with a status of "Not started" or "In Progress"
Task.complete => returns completed tasks
User.no_current_tasks => returns users who have no incomplete tasks.
User.few_current_tasks => returns users who have less than or equal to 3 incomplete tasks
Project.in_progress => Projects where the status is "In Progress"
Project.complete => Projects where the status is "Complete"
Project.icebox => Projects with no start_date and no due_date
What does the schema for our app look like?