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
23 24 25 26 27 28 29 30 |
# File 'lib/active_mongo_has_many.rb', line 23 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 |