module Mongoid::Association::Referenced::CounterCache::ClassMethods
def increment_counter(counter_name, id)
- Since: - 3.1.0
Parameters:
-
id(String) -- The id of the object that will have its counter incremented. -
counter_name(Symbol) -- Counter cache name
Other tags:
- Example: Increment comments counter -
def increment_counter(counter_name, id) update_counters(id, counter_name.to_sym => 1) end