Module: MongoMapper::Plugins::Associations::InstanceMethods

Defined in:
lib/mongo_mapper/plugins/associations.rb

Instance Method Summary collapse

Instance Method Details

#associationsObject



66
67
68
# File 'lib/mongo_mapper/plugins/associations.rb', line 66

def associations
  self.class.associations
end

#embedded_associationsObject



71
72
73
74
75
76
77
# File 'lib/mongo_mapper/plugins/associations.rb', line 71

def embedded_associations
  associations.select do |name, association|
    association.embeddable?
  end.map do |name, association|
    association
  end
end

#get_proxy(association) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/mongo_mapper/plugins/associations.rb', line 79

def get_proxy(association)
  unless proxy = self.instance_variable_get(association.ivar)
    proxy = association.proxy_class.new(self, association)
    self.instance_variable_set(association.ivar, proxy)
  end
  
  proxy
end