Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Relations::Builders::Referenced::Many

Public Instance Methods

build(type = nil) click to toggle source

This builder either takes a hash and queries for the object or an array of documents, where it will just return tem.

@example Build the documents.

Builder.new(meta, attrs).build

@param [ String ] type The type of document to query for.

@return [ Array<Document> ] The documents.

# File lib/mongoid/relations/builders/referenced/many.rb, line 16
def build(type = nil)
  return object unless query?
  return [] if object.is_a?(Array)
  crit = metadata.criteria(Conversions.flag(object, metadata), base.class)
  IdentityMap.get_many(crit.klass, crit.send(:selector_with_type_selection)) || crit
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.