starterkits / rails4-starterkit

Rails 4.1 starter app with production ready performance, security, and authentication.
MIT License
388 stars 103 forks source link

ConstraintException: PRIMARY KEY must be unique: #21

Closed sudharsans closed 10 years ago

sudharsans commented 10 years ago

Hello When I update an existing user in the User model, I am getting this error message. Could you please help?

ActiveRecord::StatementInvalid (SQLite3::ConstraintException: PRIMARY KEY must be unique: UPDATE "users" SET "confirmation_token" = ?, "current_sign_in_at" = ?, "id" = ?, "is_admin" = ?, "last_sign_in_at" = ?, "unconfirmed_email" = ?, "unlock_token" = ?, "updated_at" = ? WHERE "users"."id" = 3):

Thank you

simple10 commented 10 years ago

It looks like you're trying to update User#id which can cause problems. What is the ruby code that generated the error?

simple10 commented 10 years ago

Probably same issue https://github.com/starterkits/rails4-starterkit/issues/23