Search code examples
ruby-on-railsdevise

Delete registration after 24 hours if not confirmed (Rails, Devise)


Is there a way, maybe implemented and not seen by me, or somehow for gem 'Devise', to remove registrations of users that haven't confirmed their account for 24 hours?


Solution

  • Create your own async task and use Whenever to plan it every minute to scope your users with something like

    User.where(confirmed_at: nil).where('created_at < ?', 1.day.ago).destroy_all