Module: MongoMapper::Associations::ClassMethods

Defined in:
lib/mongomapper/associations.rb

Instance Method Summary collapse

Instance Method Details

#associationsObject



14
15
16
17
18
# File 'lib/mongomapper/associations.rb', line 14

def associations
  @associations ||= self.superclass.respond_to?(:associations) ? 
                      self.superclass.associations : 
                      HashWithIndifferentAccess.new
end

#belongs_to(association_id, options = {}) ⇒ Object



4
5
6
7
# File 'lib/mongomapper/associations.rb', line 4

def belongs_to(association_id, options = {})
  create_association(:belongs_to, association_id, options)
  self
end

#many(association_id, options = {}) ⇒ Object



9
10
11
12
# File 'lib/mongomapper/associations.rb', line 9

def many(association_id, options = {})
  create_association(:many, association_id, options)
  self
end