Module: Mongoid::Association::Embedded::EmbedsMany::Proxy::ClassMethods

Included in:
Mongoid::Association::Embedded::EmbedsMany::Proxy
Defined in:
lib/mongoid/association/embedded/embeds_many/proxy.rb

Overview

Class-level methods for the Proxy class.

Instance Method Summary collapse

Instance Method Details

#eager_loader(associations, docs) ⇒ Mongoid::Association::Embedded::Eager

Returns the eager loader for this association.

Parameters:

  • associations (Array<Mongoid::Association>)

    The associations to be eager loaded

  • docs (Array<Mongoid::Document>)

    The parent documents that possess the given associations, which ought to be populated by the eager-loaded documents.

Returns:



29
30
31
# File 'lib/mongoid/association/embedded/embeds_many/proxy.rb', line 29

def eager_loader(associations, docs)
  Eager.new(associations, docs)
end

#embedded?true

Returns true if the association is an embedded one. In this case always true.

Examples:

Is the association embedded?

Association::Embedded::EmbedsMany.embedded?

Returns:

  • (true)

    true.



40
41
42
# File 'lib/mongoid/association/embedded/embeds_many/proxy.rb', line 40

def embedded?
  true
end

#foreign_key_suffixnil

Returns the suffix of the foreign key field, either “_id” or “_ids”.

Examples:

Get the suffix for the foreign key.

Association::Embedded::EmbedsMany.foreign_key_suffix

Returns:

  • (nil)

    nil.



50
51
52
# File 'lib/mongoid/association/embedded/embeds_many/proxy.rb', line 50

def foreign_key_suffix
  nil
end