Class: CleanupRemovedRecords

Inherits:
Object
  • Object
show all
Defined in:
app/interactors/cleanup_removed_records.rb

Instance Method Summary collapse

Instance Method Details

#cleanup_records(seen_records, stored_ids, record_class) ⇒ Object


3
4
5
6
7
8
# File 'app/interactors/cleanup_removed_records.rb', line 3

def cleanup_records(seen_records, stored_ids, record_class)
  seen_ids = seen_records.map(&:id)
  missing_ids = stored_ids - seen_ids
  record_class.where(id: missing_ids, deleted_at: nil).update(deleted_at: Sequel.function(:NOW))
  missing_ids
end