Class DataMapper::Associations::ManyToOne::Relationship
In: lib/dm-core/associations/many_to_one.rb
Parent: Associations::Relationship

Relationship class with implementation specific to n side of 1 to n association

Methods

Constants

OPTIONS = superclass::OPTIONS.dup << :required << :key << :unique

External Aliases

child_repository_name -> source_repository_name
  @api semipublic
child_model -> source_model
  @api semipublic
parent_repository_name -> target_repository_name
  @api semipublic
parent_model -> target_model
  @api semipublic
parent_key -> target_key
  @api semipublic

Public Class methods

Initializes the relationship, always using max cardinality of 1.

@api semipublic

Public Instance methods

Returns a set of keys that identify source model

@return [DataMapper::PropertySet] a set of properties that identify source model @api private

@api semipublic

Initialize the foreign key property this "many to one" relationship uses to persist itself

@api public

Loads and returns association target (ex.: author) for given source resource (ex.: article)

@param source [DataMapper::Resource]

  source object (ex.: instance of article)

@param other_query [DataMapper::Query]

  Query options

@api semipublic

@api semipublic

Loads association target and sets resulting value on given source resource

@param [Resource] source

  the source resource for the association

@return [undefined]

@api private

@deprecated

@api semipublic

Returns a Resource for this relationship with a given source

@param [Resource] source

  A Resource to scope the collection with

@param [Query] other_query (optional)

  A Query to further scope the collection with

@return [Resource]

  The resource scoped to the relationship, source and query

@api private

Sets value of association target (ex.: author) for given source resource (ex.: article)

@param source [DataMapper::Resource]

  source object (ex.: instance of article)

@param target [DataMapper::Resource]

  target object (ex.: instance of author)

@api semipublic

source_key()

Alias for child_key

Returns a hash of conditions that scopes query that fetches target object

@return [Hash]

  Hash of conditions that scopes query

@api private

@api semipublic

[Validate]