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.

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Writing Test Helpers

K Jo
K Jo
7,283 Points

Tests failing. Unknown Attribute

My tests (that previously worked) are now failing. I am getting the same error for all tests, which is as follows:

Failure/Error: let!(:todo_list) { TodoList.create(title: "Grocery list", description: "Groceries") } ActiveRecord::UnknownAttributeError: unknown attribute: description

I have copied over much of the code from the downloadable project files, so I'm not sure why I am getting this.

2 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,437 Points

Check your schema.rb file and see if your todo_list table has this attribute.

K Jo
K Jo
7,283 Points

Okay, I think that is the issue, but i'm not sure how to fix it. Currently my schema.rb todo_list table is showing descriptions (plural) rather than description. It looks as though I need to change this through the console rather than directly in Sublime Text (since every time I run a migration, it changes back to descriptions (plural).

On a separate note, I notice that the next video on adding a complete_at timestamp produces a line for this in the schema.rb file of the downloadable project files. However, this is not showing on mine. I have gone through the video about 3 times and feel as though I have done every step...but i suppose I'm missing something. Thanks for the help.

K Jo
K Jo
7,283 Points

Okay, I believe I fixed it for the most part. I changed the schema.rb file to show description (singular instead of plural). Then ran rake db:schema:load. Everything seems to work for the most part now.