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 Generate a Scaffold

Kaiyang Lin
Kaiyang Lin
5,573 Points

Can't delete the todo list entry

Hey all,

Have a problem whereby clicking on the 'destroy' button doesn't actually delete the entry! Clicking on destroy only redirects me to localhost:3000/todo_lists/1 , where the number 1 refers to the entry number. I noticed that it's an alert prompt that comes up when you click destroy, so it must be an issue with the javascript

I'm running the latest version of rails (4.2.5), on a windows 10 using the Cmder interface.

Any help is greatly appreciated! Thanks!

Francois van der Hoven
Francois van der Hoven
2,026 Points

Hi Kaiyang, it is possible that some code in your javascript intercepts the click event and does not submit the form. Your destroy method in the controller is probably not executed. I suggest you use the gem, byebug (https://github.com/deivid-rodriguez/byebug), to trace your ruby code. You should also be aware of what this javascript command does: http://www.w3schools.com/jsref/event_preventdefault.asp. I know this does not solve the problem, but these are some tools to help you.