I'm making an EC site with Rails.
The following error message occurred when trying to edit a column in the user table.
** ActiveRecord :: RecordNotUnique in RailsAdmin :: MainController # edit ** SQLite3 :: ConstraintException: UNIQUE constraint failed: users.unlock_token: UPDATE "users" SET "current_sign_in_at" =?, "Last_sign_in_at" =?, "Confirmed_at" =?, "Confirmation_sent_at" =?, "Unconfirmed_email" =?, "Unlock_token "=?," provider "=?," uid "=?," username "=?," admin_flg "=?," point "=?," updated_at "=? WHERE" users "." id "=?
I can't figure out which area is suspicious, and I don't know which part of the code should be written. .
Can anyone please professor? Thank you. . .
Answer # 1
I think the
unlock_tokencolumn has a unique constraint. If a unique constraint is attached, you cannot create multiple records with the same value.
You can check the list of registered
unlock_tokenwith the following SQL.
SELECT unlock_token FROM users;
You probably already have a record with the value you are trying to update with an UPDATE statement, and that is the cause of the error. For your information.
- scss is not reflected creating a rails app
- html - media queries are adapted locally, but when i submit them to the server they are not
- images are not displayed on the [rails] and [css] pages
- html - when i see it on my smartphone, the placeholder runs out
- html - i want the elements of li to be 5 rows wide
- css - even if max-width box-sizing is specified, the width of the smartphone will overflow
- how to arrange like the attached image (html/css)
- html - elements do not line up side by side with float
- i want to adjust the placement of buttons with css