Module: Humanoid::Versioning::InstanceMethods

Defined in:
lib/humanoid/versioning.rb

Instance Method Summary collapse

Instance Method Details

#reviseObject

Create a new version of the Document. This will load the previous document from the database and set it as the next version before saving the current document. It then increments the version number.



19
20
21
22
23
24
25
# File 'lib/humanoid/versioning.rb', line 19

def revise
  last_version = self.class.first(:conditions => { :_id => id, :version => version })
  if last_version
    self.versions << last_version.clone
    self.version = version + 1
  end
end