Module: Humanoid::Versioning

Defined in:
lib/humanoid/versioning.rb

Overview

Include this module to get automatic versioning of root level documents. This will add a version field to the Document and a has_many association with all the versions contained in it.

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/humanoid/versioning.rb', line 7

def self.included(base)
  base.class_eval do
    field :version, :type => Integer, :default => 1
    has_many :versions, :class_name => self.name
    before_save :revise
    include InstanceMethods
  end
end