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



36
37
38
39
40
41
42
43
# File 'lib/active_mongo_has_many.rb', line 36

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