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

child_key   get   new   nullable?   resource_for   set   source_key  

Constants

OPTIONS = superclass::OPTIONS.dup << :nullable

External Aliases

child_repository_name -> source_repository_name
  TODO: document @api semipublic
child_model -> source_model
  TODO: document @api semipublic
parent_repository_name -> target_repository_name
  TODO: document @api semipublic
parent_model -> target_model
  TODO: document @api semipublic
parent_key -> target_key
  TODO: document @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 child model

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

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

@param source [DataMapper::Resource]

  Child object (ex.: instance of article)

@param other_query [DataMapper::Query]

  Query options

@api semipublic

TODO: document @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]

  Child object (ex.: instance of article)

@param source [DataMapper::Resource]

  Parent object (ex.: instance of author)

@api semipublic

source_key()

Alias for child_key

[Validate]