Class: Mongoid::Relations::Builders::Referenced::Many
- Inherits:
-
Mongoid::Relations::Builder
- Object
- Mongoid::Relations::Builder
- Mongoid::Relations::Builders::Referenced::Many
- Defined in:
- lib/mongoid/relations/builders/referenced/many.rb
Instance Attribute Summary
Attributes inherited from Mongoid::Relations::Builder
Instance Method Summary collapse
-
#build(type = nil) ⇒ Array<Document>
This builder either takes a hash and queries for the object or an array of documents, where it will just return tem.
Methods inherited from Mongoid::Relations::Builder
Constructor Details
This class inherits a constructor from Mongoid::Relations::Builder
Instance Method Details
#build(type = nil) ⇒ Array<Document>
This builder either takes a hash and queries for the object or an array of documents, where it will just return tem.
17 18 19 20 21 22 |
# File 'lib/mongoid/relations/builders/referenced/many.rb', line 17 def build(type = nil) return object unless query? return [] if object.is_a?(Array) crit = .criteria(Conversions.flag(object, )) IdentityMap.get(crit.klass, crit.selector) || crit end |