Skip to content

Conversation

@kaseea
Copy link

@kaseea kaseea commented Apr 15, 2019

Task List

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Describe in your own words what the Model is doing in Rails The model connects to my database and does all the logic associated with the data I'm going to use.
Describe in your own words what the Controller is doing in Rails The controller connects the model and the view, mainly by looking at the routes and calling the methods (HTTP requests), and then sending that information to the view
Describe in your own words what the View is doing in Rails The view takes the information from the controller (in this case getting our erb and turning it into HTML that will then get to the browser)
Describe an edge-case controller test you wrote That an invalid task id will redirect
What is the purpose of using strong params? (i.e. the params method in the controller) Strong params lets us pass params without listing the params individually to the activerecord model
How are Rails migrations related to Rails models? Migrations keep us from going into and manually editing the schema. Instead we use migrations to add/delete columns or any other database modification needed.
Describe one area of Rails that are still unclear on How everything is named and want it means, I feel more confident looking at files and how they relate to eachother than I do using all the rails names.

@CheezItMan
Copy link

Task List

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with no extraneous files checked in You should have more granular commits, but you have good commit messages
Answered comprehension questions Check, you'll get familiar with the Rails vocabulary soon.
Successfully handles: Index, Show They work, unstyled and with left-over placeholder HTML, and they output object ids as well.
Index & Show tests pass Check
Successfully handles: New, Create Check
New & Create tests pass Check
Successfully handles: Edit, Update Check
Tests for Edit & Update test valid & invalid task ids Check
Successfully handles: Destroy, Task Complete Check, but there's no link to delete a task, if the task is complete.
Tests for Destroy & Task Complete include tests for valid and invalid task ids Check, but see my comments
Routes follow RESTful conventions You have nonRESTful routes going to the delete and toggle_completion actions.
Uses named routes (like _path) Check
Overall You hit the learning goals for the project. That said, there's no styling and you left placeholder code in the views, as well as some nonRestful routes. For this week try to do some styling and use partial views. Take a look at my inline comments and let me know any questions you have.

@@ -0,0 +1,27 @@
<% Time.zone = "Pacific Time (US & Canada)" %>
<h1>Tasks#index</h1>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of placeholder code really should be deleted

<!DOCTYPE html>
<html>
<head>
<title>TaskList</title>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also test what happens on the next toggle.


<p><%= @task.description %></p>

<p><%= @task %></p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This other route isn't being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants