Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Marking Todo Items Complete

Having troubles with patch method

<%= link_to 'Mark complete', complete_todo_list_todo_item_path(@todo_list, todo_item), method: :patch %> always link me to show method of the controller, It will never
call the complete method of the todo_items controller. I wish anyone who took the same course could help me solve it

4 Answers

Robert Ho
Robert Ho
Pro Student 11,383 Points

can you post your controller code?

also in the video, he only has one argument in hits complete_todo_list_todo_item_path like this:

<%= link_to 'Mark complete', complete_todo_list_todo_item_path(todo_item), method: :patch %>

Thanks for you help. But I think it has nothing to do with the controller. Because the rails won't dispatch the request to the controller so complete action will not be called in any case. Plus, the reason I put 2 arguments in the link_to helper is that I didn't override the url_options method.

I try run the app in Rails 4.0.3, it seems working. But my major development environment is Rails 4.1.x, It won't work under Rails 4.1.x.

Jason Seifer
Jason Seifer
Treehouse Guest Teacher

Hey @cornerkicker can you paste a link to your code so we can take a look?