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 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?