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 Simple Ruby on Rails Application Writing Tests Fixtures

Steve Fairhurst
Steve Fairhurst
2,866 Points

Testing Issues... no column named name

Just working my way through the Treebook course and have been quite successful in tackling the ROR 4 problems but now i'm stuck.

When I run my test's i get this error: 1) Error: UserTest#test_a_user_should_enter_a_first_name: ActiveRecord::StatementInvalid: SQLite3::SQLException: table statuses has no column named name: INSERT INTO "statuses" ("name", "content", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2014-05-17 06:42:52', '2014-05-17 06:42:52', 980190962)

And so on...

As "rake db:test:prepare" is now depreciated I ran " rake test:prepare" instead and I've also run "rake db:migrate RAILS_ENV=test" but still the error is here.

I've searched the forums and the closest was the "no column named password" but this fix doesn't solve this issue.

Any help would be hugely appreciated.

2 Answers

Brandon Barrette
Brandon Barrette
20,485 Points

I think the error is that you change the status to no longer have a name entered by the user, but instead the user_id. So when you did a migration to change your database to user_id, you also need to adjust your tests for them to pass.

Jason eventually does this, but it's not obvious nor clear when he does if I remember right.

Naomi Freeman
STAFF
Naomi Freeman
Treehouse Guest Teacher

Is it still first_name or name? Or have you shifted away to full_name?

in your .permit in your controllers or in your schema