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

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

Overview

Since:

  • 2.0.0.rc.1

Instance Attribute Summary

Attributes inherited from Mongoid::Relations::Builder

#base, #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:

Since:

  • 2.0.0.rc.1



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

def build(type = nil)
  return object unless object.is_a?(Hash)
  if _loading?
    Factory.from_db(klass, object)
  else
    Factory.build(klass, object)
  end
end