module DataMapper::Constraints::Relationship::ManyToMany

Private Instance Methods

assert_valid_constraint() click to toggle source

Checks that the constraint type is appropriate to the relationship

@param [Fixnum] cardinality

cardinality of relationship

@param [Symbol] name

name of relationship to evaluate constraint of

@param [Hash] options

options hash

@option *args :constraint

one of VALID_CONSTRAINT_VALUES

@raise ArgumentError

if @option :constraint is not one of VALID_CONSTRAINT_TYPES

@return [Undefined]

@api private

Calls superclass method
# File lib/data_mapper/constraints/relationship/many_to_many.rb, line 32
def assert_valid_constraint
  super

  # TODO: is any constraint valid for a m:m relationship?
  if @constraint == :set_nil
    raise ArgumentError, "#{@constraint} is not a valid constraint type for #{self.class}"
  end
end
one_to_many_options() click to toggle source
Calls superclass method
# File lib/data_mapper/constraints/relationship/many_to_many.rb, line 10
def one_to_many_options
  super.merge(:constraint => @constraint)
end