-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ports -- Kate #45
base: master
Are you sure you want to change the base?
Ports -- Kate #45
Conversation
Task ListWhat We're Looking For
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration doesn't seem to be in your schema.
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions