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 Adding Todo Items

Anuj Nagpal
PLUS
Anuj Nagpal
Courses Plus Student 3,748 Points

Getting error even after passing todo_list as a parameter in todo_item_todo_lists_path

Failures:

1) Viewing todo items display no items when a todo list is empty Failure/Error: click_link "List Items" ActionController::RoutingError: uninitialized constant TodoItemsController

./spec/features/todo_items/index_spec.rb:9:in `block (3 levels) in '

./spec/features/todo_items/index_spec.rb:8:in `block (2 levels) in '

Finished in 0.0372 seconds 1 example, 1 failure

Failed examples:

rspec ./spec/features/todo_items/index_spec.rb:6 # Viewing todo items display no items when a todo list is empty

Randomized with seed 22431

1 Answer

Brandon Barrette
Brandon Barrette
20,485 Points

So there are 2 possibilities:

  • in your routes.rb file, you have mistyped the route. The routes should look like:

     resources :todo_lists do
      resources :todo_items
     end
    
    • Check your todo_items_conroller and make sure the file name is plural (items) and inside the file, it says (notice it's plural here too):
    class TodoItemsController < ApplicationController