Class: Upgrade::BackfillCollectionCounterCache
- Inherits:
-
IterationJob
- Object
- IterationJob
- Upgrade::BackfillCollectionCounterCache
- Defined in:
- app/jobs/upgrade/backfill_collection_counter_cache.rb
Instance Method Summary collapse
Instance Method Details
#build_enumerator(cursor:) ⇒ Object
7 8 9 10 |
# File 'app/jobs/upgrade/backfill_collection_counter_cache.rb', line 7 def build_enumerator(cursor:) # Find models that have something in the old collection field enumerator_builder.active_record_on_records(Collection.where(models_count: nil), cursor: cursor) end |
#each_iteration(record) ⇒ Object
12 13 14 |
# File 'app/jobs/upgrade/backfill_collection_counter_cache.rb', line 12 def each_iteration(record) Collection.reset_counters(record.id, :models) end |