demarches-normaliennes/app/jobs/purge_unattached_blobs_job.rb
2019-05-21 14:05:33 +02:00

9 lines
229 B
Ruby

class PurgeUnattachedBlobsJob < ApplicationJob
queue_as :cron
def perform(*args)
ActiveStorage::Blob.unattached
.where('active_storage_blobs.created_at < ?', 24.hours.ago)
.find_each(&:purge_later)
end
end