lib/counter_culture/extensions.rb in counter_culture-3.1.0 vs lib/counter_culture/extensions.rb in counter_culture-3.2.0
- old
+ new
@@ -69,11 +69,12 @@
# count
#
# options:
# { :exclude => list of relations to skip when fixing counts,
# :only => only these relations will have their counts fixed,
- # :column_name => only this column will have its count fixed }
+ # :column_name => only this column will have its count fixed
+ # :polymorphic_classes => specify the class(es) to update in polymorphic associations }
# returns: a list of fixed record as an array of hashes of the form:
# { :entity => which model the count was fixed on,
# :id => the id of the model that had the incorrect count,
# :what => which column contained the incorrect count,
# :wrong => the previously saved, incorrect count,
@@ -89,10 +90,10 @@
@after_commit_counter_cache.flat_map do |counter|
next if options[:exclude] && options[:exclude].include?(counter.relation)
next if options[:only] && !options[:only].include?(counter.relation)
- reconciler_options = %i(batch_size column_name finish skip_unsupported start touch verbose where)
+ reconciler_options = %i(batch_size column_name finish skip_unsupported start touch verbose where polymorphic_classes)
reconciler = CounterCulture::Reconciler.new(counter, options.slice(*reconciler_options))
reconciler.reconcile!
reconciler.changes
end.compact