Class: Mongoid::Relations::Builders::Embedded::In

Inherits:
Mongoid::Relations::Builder show all
Defined in:
lib/mongoid/relations/builders/embedded/in.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Mongoid::Relations::Builder

#metadata, #object

Instance Method Summary collapse

Methods inherited from Mongoid::Relations::Builder

#initialize

Constructor Details

This class inherits a constructor from Mongoid::Relations::Builder

Instance Method Details

#build(type = nil) ⇒ Document

This builder doesn’t actually build anything, just returns the parent since it should already be instantiated.

Examples:

Build the document.

Builder.new(meta, attrs).build

Parameters:

  • type (String) (defaults to: nil)

    Not used in this context.

Returns:



17
18
19
20
# File 'lib/mongoid/relations/builders/embedded/in.rb', line 17

def build(type = nil)
  return object unless object.is_a?(Hash)
  Mongoid::Factory.from_db(.klass, object)
end