Module: ActiveMongo::HasMany::InstanceMethods

Included in:
Base
Defined in:
lib/active_mongo_has_many.rb

Instance Method Summary collapse

Instance Method Details

#has_many_hit(name, attrs) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/active_mongo_has_many.rb', line 27

def has_many_hit(name, attrs)
  return false if self.new_record?
  
  attrs[:class_name] ||= name.to_s.classify
  attrs[:foreign_key] ||= self.class.name.to_s.singularize.underscore+"_id"
  
  return eval(attrs[:class_name]).with_scope(attrs[:foreign_key] => self._id )
end