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

General Discussion

Validating Presence Error

Hey Treehouse. Can anyone help with this? it's the error message I get after running the test command in the validating presence video. I've done rake db:migrate and rake db:test:prepare

test_a_user_should_enter_a_first_name(UserTest): ActiveRecord::StatementInvalid: SQLite3::ConstraintException: constraint failed: INSERT INTO "users" ("created_at", "updated_at", "id") VALUES ('2013-04-15 17:51:05', '2013-04-15 17:51:05', 298486374)


3 Answers

Do you have those fields in your test fixture? If so remove them, also ensure you have the fixtures properly nested and spaced using 2 spaces.

test > fixtures > users.yml

  first_name: "Jason"
  last_name: "Seifer"
  email: "jason@teamtreehouse.com"
  profile_name: "jasonseifer"

Thanks Drake. All sorted

Mine is empty and am still getting same error message.