Answer the question
In order to leave comments, you need to log in
How to add a new field to the database?
Hello, I forgot to add the user_id field when creating a scaffold for products. And now, after connecting and setting up the devise gem, I can't add a new product to the database.
Created a migration
rails generate migration AddPartNumberToProducts user_id:integer
rake db:migrate
SQLite3::ConstraintException: UNIQUE constraint failed: products.email: INSERT INTO "products" ("title", "description", "number", "price", "user_id", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?)
Answer the question
In order to leave comments, you need to log in
Sqlite tells you that the email field in the products table is not unique, but it should be.
Yes, not so - The value of the email field in the created record is not unique, but it should be!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question