Class: ActiveStorageDashboard::OrphanPurger
- Inherits:
-
Object
- Object
- ActiveStorageDashboard::OrphanPurger
- Defined in:
- lib/active_storage_dashboard/orphan_purger.rb
Class Method Summary collapse
Class Method Details
.call ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/active_storage_dashboard/orphan_purger.rb', line 3 def self.call scope = ActiveStorage::Blob.left_outer_joins(:attachments) .where(active_storage_attachments: { id: nil }) scope.find_each do |blob| blob.purge puts "Purged blob #{blob.id}" end end |