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 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,441 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.