Class: Mongoid::Relations::Builders::Referenced::ManyToMany
- Inherits:
-
Mongoid::Relations::Builder
- Object
- Mongoid::Relations::Builder
- Mongoid::Relations::Builders::Referenced::ManyToMany
- Defined in:
- lib/mongoid/relations/builders/referenced/many_to_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 them.
-
#query? ⇒ true, false
Do we need to perform a database query? It will be so if the object we have is not a document.
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 them.
17 18 19 20 |
# File 'lib/mongoid/relations/builders/referenced/many_to_many.rb', line 17 def build(type = nil) return object.try(:dup) unless query? .criteria(object) end |