module Mongoid::CounterCache

Public Class Methods

included(base) click to toggle source
# File lib/mongoid_countercache/counter_cache.rb, line 4
def self.included(base)
  base.send(:extend, ClassMethods)
end

Private Instance Methods

update_parent_counter(parent, field, inc, proc = nil) click to toggle source
# File lib/mongoid_countercache/counter_cache.rb, line 41
def update_parent_counter(parent, field, inc, proc = nil)
  return unless parent && parent[field]
  parent.inc(field, inc) if proc.nil? || proc.bind(self).call
end