Skip to content

Conversation

@amyesh
Copy link

@amyesh amyesh 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 It contains the data for the application, as well as performs the business logic.
Describe in your own words what the Controller is doing in Rails It processes http requests, pulls data from the model and interprets that data so that it can be passed to the view.
Describe in your own words what the View is doing in Rails It interprets the data from the controller to display in a browser.
Describe an edge-case controller test you wrote I tested that the application redirected to the home page if the user attempted to edit a nonexistent task.
What is the purpose of using strong params? (i.e. the params method in the controller) To control what data is required as well as permitted to come from our forms.
How are Rails migrations related to Rails models? You can create a model by generating an initial migration, you can also perform migration to update the schema/table of the model's database.
Describe one area of Rails that are still unclear on I'm a little scared of the altering the database for fear of MESSING EVERYTHING UP! So I'd like to practice changing the schema so that it becomes more natural.

@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 x
Tests for Destroy & Task Complete include tests for valid and invalid task ids x
Routes follow RESTful conventions x
Uses named routes (like _path) x, some places could be better in the views
Overall

Great work on this project, Amy! This totally meets all of the requirements that I was looking for: Rails best practices, RESTful routes, and CRUD operations. The code and the app look great, too. The tests look great!

That being said, I have a few comments, on honestly they're all small places of improvement/me nitpicking.

Another big comment I have is: You've included flash! I want to check-in and acknowledge that this is above and beyond our requirements. Our TaskList tests that we provided at first wrongfully had some tests on flash. Although we've removed them and updated everyone on Slack, you've kept them in -- I want to make sure you know that we didn't mean to accidentally make you use flash, we'll go over flash more in depth this week, and good job on using it in this project!

Good work on this!

end

def show
task_id = params[:id].to_i
Copy link

Choose a reason for hiding this comment

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

Actually, you don't need to do .to_i, and you can just do task_id = params[:id]! That's because Rails lets us get away with this.

@task = Task.find_by(id: task_id)
if @task.nil?
flash[:error] = "Could not find task with id: #{task_id}"
redirect_to task_path
Copy link

Choose a reason for hiding this comment

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

Actually, when you manually test this, because it redirects back to the task_path, which... is this action... and then it gets into this case again... which redirects back to the task_path... it gets into an infinite loop. You'll probably want to fix this by redirecting somewhere else

<li>
<%if task.complete == false%>
<div>
<a href="/tasks/<%=task.id%>"> <%= task.name %>: <%= task.description %> Due:<%= task.completion_date %> </a>
Copy link

Choose a reason for hiding this comment

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

Best pracitce would be to use the link_to helper, and also to reference the path with the path helper (here, task_path(task) instead of /tasks/...

</div>
<%else%>
<div class="strike">
<a href="/tasks/<%=task.id%>"> <%= task.name %>: <%= task.description %> Due:<%= task.completion_date %> </a> </div>
Copy link

Choose a reason for hiding this comment

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

Same as above: Might be good to use link_to and the path helper

</div>
<%else%>
<div class="strike">
<a href="/tasks/<%=task.id%>"> <%= task.name %>: <%= task.description %> Due:<%= task.completion_date %> </a> </div>
Copy link

Choose a reason for hiding this comment

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

indentation got kind of weird here... might want to put the ending </div> on the next line

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