Module: MongoTree::Strategies::ParentLink

Includes:
Base
Defined in:
lib/mongo_tree/strategies/parent_link.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/mongo_tree/strategies/parent_link.rb', line 6

def self.included(base)
  base.class_eval do
    key :parent_id, ObjectId, :index => true
    belongs_to :parent, :class_name => self.name
  end
  
  base.extend ClassMethods
  base.send :include, InstanceMethods
end