small medium large xlarge

Generic-user-small
31 Jul 2017, 20:13
John Schweikart (1 post)

I have completed the coding in Chapt 3 to add the postgres validation on the company domain name. I can successfully add a user - john@example.com. But if I add john@peasoup.com - get error above -

PG::CheckViolation: ERROR: new row for relation “users” violates check constraint “email_must_be_company_email” DETAIL: Failing row contains (4, john@peasoup.com, $2a$11$sl71UcMAet359HNFXlmtp.uai.fE9Njd1gpfl0UimNARjxm/zya4m, null, null, null, 0, null, null, null, null, 2017-07-31 19:58:12.159008, 2017-07-31 19:58:12.159008). : INSERT INTO “users” (“email”, “encrypted_password”, “created_at”, “updated_at”) VALUES ($1, $2, $3, $4) RETURNING “id”

Thoughts on how to correct?

Dmfcb_pragsmall
01 Aug 2017, 11:47
David Copeland (467 posts)

This is what is supposed to happen. The constraint you added prevents doing what you are attempting to do. The first part of chapter 3 explains why this is being done.

You must be logged in to comment