class Ardm::Property::Discriminator

Public Instance Methods

bind() click to toggle source

@api private

# File lib/ardm/property/discriminator.rb, line 27
def bind
  model.inheritance_column = field
  model.extend Model unless model < Model
end
dump(value) click to toggle source

ActiveRecord just stores the string name of the class. We dump false for a bad value because it results in a class that isn’t in the “dump_as”.

Expects the class name to be a valid class name that is loaded and available.

# File lib/ardm/property/discriminator.rb, line 17
def dump(value)
  dumped = typecast(value)
  dumped.name if dumped.is_a?(::Class)
end
load(value) click to toggle source
# File lib/ardm/property/discriminator.rb, line 22
def load(value)
  typecast(value)
end