Conversation
Task ListWhat We're Looking For
|
| @@ -0,0 +1,27 @@ | |||
| <% Time.zone = "Pacific Time (US & Canada)" %> | |||
| <h1>Tasks#index</h1> | |||
There was a problem hiding this comment.
This kind of placeholder code really should be deleted
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>TaskList</title> |
There was a problem hiding this comment.
It would be nice to have some navigation links on the app here to create tasks, and see the list of tasks.
| must_redirect_to tasks_path | ||
| end | ||
|
|
||
| it "redirects to task page" do |
There was a problem hiding this comment.
You also need a test for what happens if you try to destroy a nonexistant Task
| patch mark_complete_path(test_task.id) | ||
| test_task.reload | ||
|
|
||
| expect(test_task.completion).must_equal true |
There was a problem hiding this comment.
You should also test what happens on the next toggle.
|
|
||
| <p><%= @task.description %></p> | ||
|
|
||
| <p><%= @task %></p> |
There was a problem hiding this comment.
You shouldn't output the task object, it ends up putting something like this on the browser: #<Task:0x00007fa922bdf290>
|
|
||
| <h2>Tasks Completed</h2> | ||
| <% @tasks.each do |task| %> | ||
| <% if task.completion == true %> |
There was a problem hiding this comment.
So no way to mark a task incomplete after it's marked complete?
| <p><%= @task.description %></p> | ||
|
|
||
| <p><%= @task %></p> | ||
| <%= button_to "click me to delete #{@task.title}", task_path, method: :delete %> No newline at end of file |
There was a problem hiding this comment.
You really don't need the separate page for deleting, instead you can do something like this:
<%= button_to "Delete #{@task.title}", task_path, method: :delete, data: { confirm: "Are you sure you want to delete the #{@task.title}?"}
|
|
||
| resources :tasks | ||
|
|
||
| get "tasks/:id/delete", to: "tasks#delete", as: "delete_task" |
There was a problem hiding this comment.
Just to note, this isn't a RESTful route.
| resources :tasks | ||
|
|
||
| get "tasks/:id/delete", to: "tasks#delete", as: "delete_task" | ||
| get "/tasks/:id/complete", to: "tasks#toggle_completion", as: "mark_complete" |
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions