Methods

Files

DataMapper::Is::Versioned::ClassMethods

Public Instance Methods

const_missing(name) click to toggle source
# File lib/dm-is-versioned/is/versioned.rb, line 74
def const_missing(name)
  if name == :Version
    model = DataMapper::Model.new(name, self)

    properties.each do |property|
      type = case property
        when DataMapper::Property::Discriminator then Class
        when DataMapper::Property::Serial        then Integer
      else
        property.class
      end

      options = property.options.merge(:key => property.name == @on)

      options[:key] = true if options.delete(:serial)

      model.property(property.name, type, options)
    end

    model
  else
    super
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.