Class: Mongoid::Relations::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/mongoid/relations/builder.rb

Overview

Superclass for all builder objects. Builders are responsible for either looking up a relation’s target from the database, or creating them from a supplied attributes hash.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metadata, object, loading = false) ⇒ Builder

Instantiate the new builder for a relation.

Examples:

Create the builder.

Builder.new(metadata, { :field => "value })

Parameters:

  • metadata (Metdata)

    The metadata for the relation.

  • object (Hash, BSON::ObjectId)

    The attributes to build from or id to query with.

Since:

  • 2.0.0.rc.1



22
23
24
25
# File 'lib/mongoid/relations/builder.rb', line 22

def initialize(, object, loading = false)
  @metadata, @object = , object
  @loading = loading
end

Instance Attribute Details

#loadingObject (readonly)

Returns the value of attribute loading.



10
11
12
# File 'lib/mongoid/relations/builder.rb', line 10

def loading
  @loading
end

#metadataObject (readonly)

Returns the value of attribute metadata.



10
11
12
# File 'lib/mongoid/relations/builder.rb', line 10

def 
  @metadata
end

#objectObject (readonly)

Returns the value of attribute object.



10
11
12
# File 'lib/mongoid/relations/builder.rb', line 10

def object
  @object
end