Open
Conversation
Task ListWhat We're Looking For
|
CheezItMan
reviewed
Apr 16, 2019
app/views/tasks/index.html.erb
Outdated
| <button type="button" class="left btn-outline-success"><%= link_to "EDIT", edit_task_path(task[:id]) %></button> | ||
| <button type="button" class="right btn-outline-danger"><%= link_to "DELETE", task, method: :delete, data: { confirm: "Really, though? This can't be undone." }%></button></div> | ||
| <p><button type="button" class="btn btn-info"><%= link_to "Uncomplete", complete_task_path(task), method: :patch %></button></p> | ||
| </p>Completed <%= time_ago_in_words(task.completed_at)%> ago.</p> |
There was a problem hiding this comment.
Your Task model doesn't have a completed_at field. Instead I would simply make this line:
<p><%= task.completed ? "Completed": "Incomplete" %></p>|
|
||
| class Task < ApplicationRecord | ||
| def completed? | ||
| !completed_at.blank? |
There was a problem hiding this comment.
You don't have a completed_at field, instead maybe just return completed.
app/controllers/tasks_controller.rb
Outdated
| end | ||
|
|
||
| def create | ||
| @task = Task.create task_params |
There was a problem hiding this comment.
I'm getting an error that ERROR: null value in column "completed_at" violates not-null constraint, this means you have a field completed_at that can't be nil, but you're not setting it in your strong params.
| @@ -0,0 +1,5 @@ | |||
| class AddDueDateToTasks < ActiveRecord::Migration[5.2] | |||
| def change | |||
| add_column :tasks, :due_date, :datetime | |||
There was a problem hiding this comment.
This migration doesn't seem to be in your schema.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions