Skip to content

Conversation

@Kimberly-Fasbender
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 Each model has a corresponding schema/table in the database with which it communicates directly (in this assignment the tasks schema/table). The model would also be the place in Rails that would take care of all business logic (calculations using data from the database), but in this particular program, we didn't really have any business logic that needed to be preformed, so the task.rb document is empty.
Describe in your own words what the Controller is doing in Rails The controller is the middle man, so to speak. It receives information from the router, which tells it which action (method) to use, and then talks to the model and view. After that, it sends a view back to the browser if there is one to send.
Describe in your own words what the View is doing in Rails The controller and view talk to one another, so before anything else, the view runs any embedded Ruby code (using variables and information it receives from the controller). Then, it sends pure html back to the controller, which send that to the browser to display.
Describe an edge-case controller test you wrote Checking that updating a task with an invalid id will redirect the user to the root path (or homepage).
What is the purpose of using strong params? (i.e. the params method in the controller) If we try to pass all of the data from the params without listing them all individually, we get an error. This is a security deal, so that someone couldn't update sensitive/private data that they shouldn't be. Strong params is a work around for the developer, so that we don't have to list the params out individually every time, but we still have that level of security intact.
How are Rails migrations related to Rails models? A migration is a change to a database schema. When we originally create the model, we invoke a migration to create schema, then any time we need to change something (add a column, delete a column, change a data type, etc), we invoke another migration.
Describe one area of Rails that are still unclear on I feel like I'm still a little shaky on what all needs to be tested for each controller action, and how exactly to test those things. I found myself flipping back and forth between our Tasklist project and the Ada Books live code, in order to compare.

… Tasks to the database, and added the show action to the Task Controller
@CheezItMan
Copy link

Task List

What We're Looking For

Feature Feedback
Baseline
Appropriate Git Usage with no extraneous files checked in Good number of commits and good commit messages
Answered comprehension questions Check, you did pretty well on the controller tests, but it's normal to feel shaky at this point.
Successfully handles: Index, Show Check
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
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, well done!
Overall Very nice work. The site is well styled and you hit all expectations. See my inline comments, but they're minor things. Well done, you hit all learning goals!


patch mark_complete_path(task.id)

expect(task.reload.completion_date).must_equal Date.today

Choose a reason for hiding this comment

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

You should also write a test that you can toggle the task back to incomplete after being marked complete.

def create
task = Task.new(task_params)

if task.name == ""

Choose a reason for hiding this comment

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

Nice, home-made validation!


if task.nil?
head :not_found
elsif !task.completed

Choose a reason for hiding this comment

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

You could also do:

else 
  task.completed = !task.completed
  task.completion_date = task.completed ? Date.today : nil
end

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