Skip to content

Earth/Taylor#46

Open
TaylorMililani wants to merge 5 commits intoAda-C14:masterfrom
TaylorMililani:master
Open

Earth/Taylor#46
TaylorMililani wants to merge 5 commits intoAda-C14:masterfrom
TaylorMililani:master

Conversation

@TaylorMililani
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 talks to the database, and can add data, find data, and remove data.
Describe in your own words what the Controller is doing in Rails The controller is the middle-man between the view and the model. It can make data available to the view, and save/update data for the model.
Describe in your own words what the View is doing in Rails The view display data to the user. It uses embedded ruby in html to render the pages the user sees.
Describe an edge-case controller test you wrote If a user wanted to destroy a task with an invalid id, the test makes sure the user will be redirected.
What is the purpose of using strong params? (i.e. the params method in the controller) It DRYs up your code and allows you to be less repetitive/type less.
How are Rails migrations related to Rails models? They both allow you to modify data in a database.
Describe one area of Rails that are still unclear on When/how often I should be making migrations. Are they similar commits in git?

@jmaddox19
Copy link

TaskList Feedback

Task List

Major Learning Goals/Code Review

Comprehension questions:

In response to your last note: Running migrations is only something to do after you've created a new migration that you haven't yet run. Running rails db:migrate:status enables you to see whether you have any migrations that are currently "down". Hopefully that'll feel more clear as you do more work in Rails but that's also a great question to bring to roundtables or an office hours session!

Criteria yes/no, and optionally any details/lines of code to reference
At least 6 commits with meaningful commit messages I would encourage you to make commits much more frequently :)
Routes follow RESTful conventions ✔️
Uses named routes (like _path) ✔️
Creates Models and migrations ✔️
Creates styled views No styling
Handles errors like nonexistant tasks The code is there to handle nonexistant tasks but the head :temporary_redirect syntax that's used in many place results in a blank page rather than a redirect. In case you didn't do this, I encourage you to run the server on your computer and test things out as you're building them
Uses form_with to render forms in Rails ✔️

Functional Requirements/Manual Testing

Functional Requirement yes/no
Successfully handles index & show ✔️
index & show tests pass ✔️
Successfully handles: New, Create ✔️
New, Create tests pass ✔️
Successfully handles: Edit, Update ✔️
Edit, Update tests pass with valid & invalid task ids ✔️
Successfully handles: Destroy, Task Complete ✔️
Tests for Destroy & Task Complete include tests for valid and invalid task ids ✔️

Overall Feedback

Great work! You made a fully-functional multi-page Ruby on Rails website!!! In just a week!

And all the code is easy to read and understand! 👏👏👏

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 5+ in Code Review && 6+ in Functional Requirements ✔️
Yellow (Approaches Standards) 3+ in Code Review && 5+ in Functional Requirements, or the instructor judges that this project needs special attention
Red (Not at Standard) 0-2 in Code Review or 0-4 in Functional Reqs, or assignment is breaking/doesn’t run with less than 5 minutes of debugging, or the instructor judges that this project needs special attention

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Concise
Logical/Organized

def show
@task = Task.find_by(id: params[:id])
if @task.nil? == true
head :temporary_redirect

Choose a reason for hiding this comment

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

This doesn't actually trigger a redirect so the user just ends up seeing a blank page. The redirect_to method on line 23 does though

Comment on lines +139 to +144
it "successfully deletes an existing Task" do
existing_task = Task.last

expect {
delete task_path(existing_task.id)
}.must_change "Task.count", -1

Choose a reason for hiding this comment

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

Suggested change
it "successfully deletes an existing Task" do
existing_task = Task.last
expect {
delete task_path(existing_task.id)
}.must_change "Task.count", -1
it "successfully deletes an existing Task" do
task.save
expect {
delete task_path(task.id)
}.must_change "Task.count", -1

I noticed this test and another were erroring out for the same reason and I didn't understand why so I decided to look into it.
It turns out let syntax does not properly update the test database so that task from the let block isn't there.
If you change the code to what I have here, the test passes because the task is actually added to the test database.

Choose a reason for hiding this comment

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

I hope you didn't spend too much time on this. It's a really funky thing that we didn't ever explain!
It would really be better if the test we gave you had used a before block instead because then the test database would've been populated as you expected.

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