Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Relations::Builders::Referenced::In

Public Instance Methods

build(type = nil) click to toggle source

This builder either takes a foreign key and queries for the object or a document, where it will just return it.

@example Build the document.

Builder.new(meta, attrs).build

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

@return [ Document ] A single document.

# File lib/mongoid/relations/builders/referenced/in.rb, line 16
def build(type = nil)
  return object unless query?
  model = type ? type.constantize : metadata.klass
  metadata.criteria(object, model).from_map_or_db
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.