Skip to content

Conversation

@Faiza1987
Copy link

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 contains the back-end logic and communicates with the database. It is like a Ruby class.
Describe in your own words what the Controller is doing in Rails The Controller is the middle man. It receives the request from the router (HTTP requests) and then it gathers data from the model and sends it to the appropriate view to be displayed.
Describe in your own words what the View is doing in Rails The View is what is presented to the user. It is what the user interacts with (it has buttons and links that can be clicked).
Describe an edge-case controller test you wrote I wrote a test to display a 404 error if an invalid Id was given.
What is the purpose of using strong params? (i.e. the params method in the controller) We use strong params within our controllers to provide a safe way to require and permit data that comes from our forms.

How are Rails migrations related to Rails models? | Migrations can be used to change the structure of the database.
Describe one area of Rails that are still unclear on | The route patterns that apparently return a response even though they don't lead to anything.

@tildeee
Copy link

tildeee commented Apr 22, 2019

Task List

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with no extraneous files checked in x
Answered comprehension questions x
Successfully handles: Index, Show x
Index & Show tests pass x
Successfully handles: New, Create x
New & Create tests pass x
Successfully handles: Edit, Update x
Tests for Edit & Update test valid & invalid task ids x
Successfully handles: Destroy, Task Complete Destroy works, Task Complete doesn't work correctly
Tests for Destroy & Task Complete include tests for valid and invalid task ids
Routes follow RESTful conventions x
Uses named routes (like _path) x
Overall

Hi Faiza, good job with the beginning functionality of your project. It follows the conventions of RESTful routing, CRUD, and best practices for Rails as we expected and outlined.

However, your interpretation of the "Task Complete" functionality is extremely not in the correct direction, and I want to address it. There are a lot of parts of your approach to the feature that concern me. I'd love to be able to chat some time about the following things:

  • How did you design the functionality? What did you intend for it to do?
  • What is your understanding of booleans and conditional logic?
  • What does toggle do? How does it work in your app?

Let's chat about this sometime in a one-on-one. I'll talk with you next week.

Good job with getting the Rails part of this project done well and done to standard. However, your approach to the custom logic concerns me.

class TasksController < ApplicationController

def index
@tasks = Task.all.order(:id)
Copy link

Choose a reason for hiding this comment

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

Nice attention to detail by ordering

def new
@task = Task.new
@task.task = "I have to... "
@task.completed = "Incomplete"
Copy link

Choose a reason for hiding this comment

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

What data type should @task.completed be? Right here you set it to a string ("Incomplete"). What logic does the task need to do in order to make task completion functional?

def complete
task = Task.find_by(id: params[:id])

task.completed?
Copy link

Choose a reason for hiding this comment

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

The line task.completed? does nothing -- It just returns a boolean and then does nothing with it. Usually, we pair booleans with conditionals. What were you intending to do with this line of code?

task = Task.find_by(id: params[:id])

task.completed?
task.toggle(:completed)
Copy link

Choose a reason for hiding this comment

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

Why would you always toggle this boolean?

Completion status: <%= todo_item.completed %><br/>
<%= link_to todo_item.task, task_path(todo_item.id) %>,
<%= button_to "Mark Complete", {action: "complete", id: todo_item.id}, method: :patch, class: "complete-button" %>
<%= button_to "Mark Incomplete", {action: "complete", id: todo_item.id}, method: :patch, class: "incomplete-button" %><br/>
Copy link

Choose a reason for hiding this comment

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

Both the "Mark Complete" and "Mark Incomplete" buttons go to the same controller action, which both toggle the completeness of the task. What is the effect? What happens when you manually test this feature out?

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