Skip to content

Earth - Ringo#36

Open
ringolingo wants to merge 13 commits intoAda-C14:masterfrom
ringolingo:master
Open

Earth - Ringo#36
ringolingo wants to merge 13 commits intoAda-C14:masterfrom
ringolingo:master

Conversation

@ringolingo
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 holds the information about each entry in the database so that it contains the specified fields.
Describe in your own words what the Controller is doing in Rails The controller routes commands from the user, manipulating information from the model and sending it to the view.
Describe in your own words what the View is doing in Rails The view handles the formatting to display the information to the user.
Describe an edge-case controller test you wrote One edge case was if the edit action was called for a task that does not exist. To test this I used an id of -1 for the edit_task_path parameter and asserted that the program must redirect to the tasks page.
What is the purpose of using strong params? (i.e. the params method in the controller) The strong params are a security measure to prevent users from editing attributes they should not edit. Strong params specifies which attributes the controller is able to edit.
How are Rails migrations related to Rails models? Migrations are changes to the structure of the database. Migrations are generated when you generate a new model, as the structure of the database is laid out when you define what attributes the model will have. If you update the attributes of your model, you need to make corresponding changes to the database structure, which necessitates a migration.
Describe one area of Rails that are still unclear on I am still unclear on the responses to unsuccessful queries and commands. I found it confusing when to redirect, render, or respond with not found and I wasn't sure if or how those could be combined. That also made writing tests difficult.

Copy link

@kaidamasaki kaidamasaki left a comment

Choose a reason for hiding this comment

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

Great job! You've made a Rails app!

It's on the small side but that doesn't make it any less impressive!

Congrats! You're now a full stack developer!

Task List

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
At least 6 commits with meaningful commit messages ✔️
Routes follow RESTful conventions ✔️
Uses named routes (like _path) ✔️
Creates Models and migrations ✔️
Creates styled views ✔️
Handles errors like nonexistant tasks ✔️
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

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

@task = Task.find_by(id: task_id)

if @task.nil?
redirect_to tasks_path and return

Choose a reason for hiding this comment

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

I really like how and return reads here.

if @task.save
redirect_to task_path(@task) and return
else
render :new and return

Choose a reason for hiding this comment

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

It's helpful to return a non-success status when you render after failing to save:

Suggested change
render :new and return
render :new, status: :bad_request and return

describe "destroy" do
# Your tests go here
it "will destroy a task" do
trash = Task.create(name: "throw this away", description: "delete this task")

Choose a reason for hiding this comment

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

🗑️

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