module Mongoid::Relations::CounterCache
Public Instance Methods
reset_counters(*counters)
click to toggle source
Reset the given counter using the .count() query from the db. This method is usuful in case that a counter got corrupted, or a new counter was added to the collection.
@example Reset the given counter cache
post.reset_counters(:comments)
@param [ Symbol, Array ] One or more counter caches to reset
@since 4.0.0
# File lib/mongoid/relations/counter_cache.rb, line 16 def reset_counters(*counters) self.class.reset_counters(self, *counters) end