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
Dan Boyle
2,978 PointsRails Todo Project
I'm going through the rails todo project. Working on deleting todo items... Here's my todo_items controller where I'm deleting...
def destroy @todo_list = @todo_list.todo_items.find(params[:id]) if @todo_item.destroy flash[:success] = "Todo list item was deleted" else flash[:error] = "Todo list item could not be deleted" end redirect_to todo_list_todo_items_path end
I keep getting an error for undefined method 'destroy' for nil:NilClass
I can't figure it out. I check the videos again... and stackoverflow and can't seem to figure out why this isn't working.
Any ideas?
Thanks!
2 Answers
Magnus Hovland
5,657 PointsPost how you solved it, so anyone else who runs into the same thing can learn from you! :)
Dan Boyle
2,978 PointsFigures... I find the issue right after posting. Always happens that way right?