Sprankelprachtig aan/afmeldsysteem

sessions.rake 372B

1234567891011
  1. namespace :sessions do
  2. desc "Clean all expired sessions from the database"
  3. task clean: :environment do
  4. expired = Session.where('sessions.expires < ?', Time.zone.now)
  5. deactivated = Session.where(active: false)
  6. puts "Cleaning #{expired.count} expired, #{deactivated.count} deactivated sessions."
  7. expired.destroy_all
  8. deactivated.destroy_all
  9. end
  10. end