Conversation
Task ListWhat We're Looking For
Jillianne! Great work with this project! Your code meets all of the requirements I was looking for: Rails best practices, RESTful routing, and CRUD. Particularly, I loooove how well-written your controller tests are! I only have a few notes for improvement. Otherwise, I think this is a great project submission. Also, I want to note that your Well done! |
| class TasksController < ApplicationController | ||
| # TASKS = [ | ||
| # {name: "Call Ma", description: "Family First", completed_at: "", completion_date: ""} | ||
| # ] |
There was a problem hiding this comment.
Don't forget to delete unused variables!
| # ] | ||
|
|
||
| def index | ||
| @tasks = Task.all.order(:created_at) |
| def toggle_complete | ||
| task = Task.find_by(id: params[:id]) | ||
|
|
||
| if task.completed_at == "Incomplete" |
There was a problem hiding this comment.
Instead of assuming that .completed_at will be a string of either "Incomplete" or "Complete", is there a better data type for this?
I think a boolean would be much better, and would prevent bugs. This way you don't need to do if ... elsif ... else, but just if ... else
| def toggle_complete | ||
| task = Task.find_by(id: params[:id]) | ||
|
|
||
| if task.completed_at == "Incomplete" |
There was a problem hiding this comment.
Is completed_at the best name for this attribute if it is describing the state of the task's completion?
| @@ -0,0 +1,37 @@ | |||
| <link href="stylesheets/index.css" rel="stylesheet" type="text/css"> | |||
There was a problem hiding this comment.
You shouldn't need to do have this line in order to load your CSS. Rails should know how to load its own CSS
| <% @tasks.each do |task| %> | ||
| <br> | ||
| <td><%= task.name %></td> | ||
| <% if task.completed_at.nil? %> |
There was a problem hiding this comment.
You'll probably want to indent the code that's within the if (and also the else)
| <br> | ||
| <td><%= task.name %></td> | ||
| <% if task.completed_at.nil? %> | ||
| <br> |
There was a problem hiding this comment.
Better to not use br tags as they're not semantic
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions