Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Deleting Todo Items

Anuj Nagpal
Anuj Nagpal
552 Points

No route matches [DELETE] "/todo_lists/1/todo_items"

Routing Error No route matches [DELETE] "/todo_lists/1/todo_items"

Rails.root: /Users/anuj.nagpal/project/odot

Application Trace | Framework Trace | Full Trace Routes

4 Answers

Try this:

<%= link_to "Delete", todo_list_todo_item_path(todo_item.todo_list, todo_item), method: :delete, data: { confirm: "Are you sure?" } %>

My reading of this is you need to pass in which list you are deleting from AND which item is being deleted to the method.

Need to see your code seems like you made an error in the routes file

Jeff Lange
Jeff Lange
8,788 Points

Yes, as Sherwyn said above, you'll need to post the todo_item_controller.rb file, the view file that goes with it (possibly show.html.erb? It will be in the todo_item folder in the views folder), and the routes.rb file.

Brian Patterson
Brian Patterson
19,588 Points

I am getting the same error. What was the solution?