Class: Importo::PurgeImportJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- Importo::PurgeImportJob
- Defined in:
- app/jobs/importo/purge_import_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(owner, months, state = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/jobs/importo/purge_import_job.rb', line 3 def perform(owner, months,state = nil) imports = Import.where(importo_ownable: owner, created_at: ..months.months.ago.beginning_of_day) imports = imports.where(state: state) if state imports.each do |import| import.original.purge import.result.purge end imports.in_batches.destroy_all end |