Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
PLUS
Robert Ho
Courses Plus 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
STAFF
Jason Seifer
Treehouse Guest Teacher

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