Skip to content

Conversation

@minams
Copy link

@minams minams 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 keeps track of the data and is where the business logic lives.
Describe in your own words what the Controller is doing in Rails The Controller is the center of the program and coordinates the interaction between the user, the views, and the models.
Describe in your own words what the View is doing in Rails The View presents information to the user.
Describe an edge-case controller test you wrote An edge-case controller test I wrote is whenever an invalid ID is used. The way I wrote the method in my controller, I expected the program to respond with a 302.
What is the purpose of using strong params? (i.e. the params method in the controller) A security feature to ensure users cannot update sensitive model attributes that they should not be updating.
How are Rails migrations related to Rails models? Rails migrations can add or modify Rails models.
Describe one area of Rails that are still unclear on Styling.

@CheezItMan
Copy link

Task List

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with no extraneous files checked in A few more commits would be better, but you have good commit messages
Answered comprehension questions Check, Migrations don't change the models really, they change the database tables.
Successfully handles: Index, Show Check
Index & Show tests pass Check
Successfully handles: New, Create
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
Tests for Destroy & Task Complete include tests for valid and invalid task ids Check
Routes follow RESTful conventions Check
Uses named routes (like _path) Check
Overall Nice work, you hit all the requirements. For the project this week, I'd encourage you to spend some time styling the app, just for practice. You also did a really good job with the testing. Well done

get "/tasks/:id/edit", to: "tasks#edit", as: "edit_task"
patch "/tasks/:id", to: "tasks#update"

patch "/tasks/:id/mark_complete", to: "tasks#mark_complete", as: "mark_complete"

Choose a reason for hiding this comment

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

Just a note, that you don't need 2 routes to toggle the task between complete and incomplete, you could do it with one.

if task.save
redirect_to root_path
else
render :new

Choose a reason for hiding this comment

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

Niiiice

def edit
@task = Task.find_by(id: params[:id])
if @task.nil?
flash[:error] = "Could not find task with id: #{params[:id]}"

Choose a reason for hiding this comment

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

👍

# Assert
must_respond_with :redirect
expect(flash[:error]).must_equal "Could not find task with id: -1"
must_respond_with 302

Choose a reason for hiding this comment

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

I suggest using the rails symbols for response codes instead of using the numbers. It's just more readable.

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