Module: DataMapper::Is::Versioned::ClassMethods

### Home Classes Methods

### In Files

- lib/dm-is-versioned/is/versioned.rb

### Methods

- #const_missing

### Files

- LICENSE

### Class/Module Index

Quicksearch

- DataMapper
- DataMapper::Is
- DataMapper::Is::Versioned
- DataMapper::Is::Versioned::ClassMethods
- DataMapper::Is::Versioned::InstanceMethods
- DataMapper::Is::Versioned::Migration
- DataMapper::Model

No matching classes.

# 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.