0

I deleted a User record in rails console and it is still throwing a uniq key violation when I try to add a user with the deleted user's email.

I feel like Redis To Go on heroku might have cached that user (I am not very familiar with caching) and that's why the User with that email does NOT show up when I do find_by(email:"email@email.com") or when I do User.all.

I believe it might be sticking around in the cache? If so, how do I clear that cache?

I am using Rails 4, heroku, postgres, Redis To Go

NothingToSeeHere
  • 2,253
  • 5
  • 25
  • 57
  • I'd be surprised if it were a caching layer somewhere. It would be helpful to cut-n-paster the "uniq key violation" error message in full into the question. Can you reproduce from the rails console? (i.e. User.create!(email: 'email@email.com') ... plus any other required attributes) – Lucas Nelson May 07 '16 at 03:45
  • it's "duplicate key value violates unique constraint "index_users_on_email" – NothingToSeeHere May 07 '16 at 09:36
  • 1
    That smells like it's coming from your database. What if you use `rails db` and try to select a record with the same email address by hand? – Lucas Nelson May 08 '16 at 02:05

0 Answers0