RelWrapper

Provides the interface needed to interact with the ActiveRel query factory.

Constants

Methods

#create_method

def create_method
  creates_unique? ? :create_unique : :create
end

#creates_unique

def creates_unique(option = :none)
  option = :none if option == true
  @creates_unique = option
end

#creates_unique?

def creates_unique?
  !!@creates_unique
end

#creates_unique_option

def creates_unique_option
  @creates_unique || :none
end

#initialize

def initialize(association, properties = {})
  @association = association
  @properties = properties
  @type = association.relationship_type(true)
  creates_unique(association.creates_unique_option) if association.unique?
end

#persisted?

def persisted?
  false
end
#properties

Returns the value of attribute properties

def properties
  @properties
end
#properties=

Sets the attribute properties

def properties=(value)
  @properties = value
end
#props_for_create

Returns the value of attribute properties

def properties
  @properties
end
#type

Returns the value of attribute type

def type
  @type
end

#unique?

def creates_unique?
  !!@creates_unique
end