Module: Mongoid::MagicCounterCache

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid/magic_counter_cache.rb,
lib/mongoid/magic-counter-cache/version.rb

Overview

The Counter Cache will yada yada

class Person
  include Mongoid::Document

  field :name
  field :feeling_count
  has_many :feelings
end

class Feeling
  include Mongoid::Document
  include Mongoid::MagicCounterCache

  field :name
  belongs_to    :person
  counter_cache :person
end

Alternative Syntax

class Person
  include Mongoid::Document

  field :name
  field :all_my_feels
  has_many :feelings
end

class Feeling
  include Mongoid::Document
  include Mongoid::MagicCounterCache

  field :name
  belongs_to    :person
  counter_cache :person, :field => "all_my_feels"
end

Defined Under Namespace

Modules: ClassMethods, LegacyCache, ModernCache

Constant Summary collapse

VERSION =
"1.1.1"