Module: DataMapper::Is::Versioned::InstanceMethods

### Home Classes Methods

### In Files

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

### Methods

- #pending_version_attributes
- #versions

### 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::InstanceMethods

### Public Instance Methods

pending_version_attributes() click to toggle source

Returns a hash of original values to be stored in the versions table when a new version is created. It is cleared after a version model is created.

-- @return <Hash>

    # File lib/dm-is-versioned/is/versioned.rb, line 108
    def pending_version_attributes
      @pending_version_attributes ||= {}
    end

versions() click to toggle source

Returns a collection of other versions of this resource. The versions are related on the models keys, and ordered by the version field.

-- @return <Collection>

    # File lib/dm-is-versioned/is/versioned.rb, line 119
    def versions
      version_model = model.const_get(:Version)
      query = Hash[ model.key.zip(key).map { |p, v| [ p.name, v ] } ]
      query.merge!(:order => version_model.key.map { |k| k.name.desc })
      version_model.all(query)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.