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.

Andreaus Perkins
14,402 PointsCan someone explain the difference between TodoList and todo_list, when you're trying to verify the existence of titles?
Can someone explain why we're using TodoList and not todo_list (or todo_lists)?
it "displays an error when the todo list has no title" do
expect(TodoList.count).to eq(0)
Any help is appreciated.
6 Answers

Roberto Alicata
Courses Plus Student 39,959 PointsTodoList is the the name of the Model ( that inherits from ActiveRecord::Base ).

Roberto Alicata
Courses Plus Student 39,959 PointsThe Test starts expecting there are no Todo List checking TodoList.count.
Then it continue trying to add a new Todo list but without a title, so we want it returns an error and the TodoList.count still be 0. In fact, if the todolist does not have a title no records are saved in the database.

Andreaus Perkins
14,402 PointsSo why are we using "TodoList" instead of "todo_list"? I'm still confused. The app is named "odot", so I'm not sure where TodoList came from.

Andreaus Perkins
14,402 PointsSo "TodoList.count" is checking the entire class for an entry?

Roberto Alicata
Courses Plus Student 39,959 PointsYes it checks the TodoList table on the database. The TodoList is the class name for your model that was created when you wrote the command "rails generate scaffold todo_list ...." in the app/models/todo_list.rb

Andreaus Perkins
14,402 PointsThanks Roberto!

Ben Goldman
14,626 PointsThanks from me, too! Great answer.