module ActiveRecord::CounterCache::ClassMethods

Public Instance Methods

update_counters(id, counters) click to toggle source
# File lib/composite_primary_keys/counter_cache.rb, line 4
def update_counters(id, counters)
  # CPK
  if self.composite?
    predicate = cpk_id_predicate(self.arel_table, primary_key, id)
    unscoped.where!(predicate).update_counters(counters)
  else
    unscoped.where!(primary_key => id).update_counters(counters)
  end
end