Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Relations::Builders::Referenced::One

Public Instance Methods

build(type = nil) click to toggle source

This builder either takes an _id or an object and queries for the inverse side using the id or sets the object.

@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/one.rb, line 16
def build(type = nil)
  return object unless query?
  return nil if base.new_record?
  metadata.criteria(Conversions.flag(object, metadata), base.class).from_map_or_db
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.