-
Notifications
You must be signed in to change notification settings - Fork 49
Ports - Mina #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Ports - Mina #35
Conversation
Task ListWhat We're Looking For
|
| 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" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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]}" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions