Cannot remove secondary e-mail identical to primary e-mail through UI

The email addresses are in the user_emails table. You can find them with the ID of the user:

UserEmail.where(user_id: <user_id>)

Replace <user_id> in the command above with the user’s ID.

Find the id value of the UserEmail record that you want to remove. With that ID, run the following to return the individual record that you want to remove:

identical_email = UserEmail.find(<identical_email_id>)

Double check the result that is returned to confirm it’s the email you want to remove. Then run:

identical_email.destroy

Before running any destructive commands from the console, it’s a good idea to create a backup of your site’s database. If something goes wrong, you can restore the backup.