9 lines
270 B
Ruby
9 lines
270 B
Ruby
class Cron::PurgeUnattachedBlobsJob < Cron::CronJob
|
|
self.schedule_expression = "every day at midnight"
|
|
|
|
def perform(*args)
|
|
ActiveStorage::Blob.unattached
|
|
.where('active_storage_blobs.created_at < ?', 24.hours.ago)
|
|
.find_each(&:purge_later)
|
|
end
|
|
end
|