Class/Module Index [+]

Quicksearch

DataMapper::Query::Conditions::RelationshipHandler

Included into comparisons which are capable of supporting Relationships.

Public Instance Methods

foreign_key_mapping() click to toggle source

Returns the conditions required to match the subject relationship

@return [Hash]

@api semipublic

# File lib/dm-core/query/conditions/comparison.rb, line 470
def foreign_key_mapping
  relationship = subject.inverse
  relationship = relationship.links.first if relationship.respond_to?(:links)

  Query.target_conditions(value, relationship.source_key, relationship.target_key)
end
matches?(record) click to toggle source

Tests that the record value matches the comparison

@param [Resource, Hash] record

The record containing the value to be matched

@return [Boolean]

@api semipublic

# File lib/dm-core/query/conditions/comparison.rb, line 457
def matches?(record)
  if relationship? && expected.respond_to?(:query)
    match_relationship?(record)
  else
    super
  end
end
relationship?() click to toggle source

Returns whether this comparison subject is a Relationship

@return [Boolean]

@api semipublic

# File lib/dm-core/query/conditions/comparison.rb, line 445
def relationship?
  subject.kind_of?(Associations::Relationship)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.