Question

I started using Devise without :confirmable. Now I've added it, and my users are being told to confirm their account, even though many have registered over a year ago.

I need to programmatically confirm all old users in the db. How can I do this?

Was it helpful?

Solution

You have to just set confirmed_at to some past date it will work fine. you can update confirmation_sent_at if you are going to use it for some other purpose like statistics.

OTHER TIPS

It is probably best you write a migration where you update the new fields of your users table. I think since you are using devise you have to set the fields confirmed_at and confirmation_sent_at to something around when your old users where created. It is also a good idea to write a test for this before applying it to production.

The easiest way probably would be to fire up the prodution console, select all old users and call confirm on each user object! This should set the fields to the current date.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top