Skip to content

Commit

Permalink
Fall back to 1 when revising a version.
Browse files Browse the repository at this point in the history
In my case I've added Versioning at a later point and old document had no version field
as this field would be only populated on creating the document
  • Loading branch information
TomK32 authored and Jacques Crocker committed Sep 13, 2010
1 parent 5e6466e commit 53e782a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongoid/versioning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def revise
if last_version
self.versions << last_version.clone
self.versions.shift if self.class.version_max.present? && self.versions.length > self.class.version_max
self.version = version + 1
self.version = (version || 1 ) + 1
@modifications["versions"] = [ nil, @attributes["versions"] ] if @modifications
end
end
Expand Down

0 comments on commit 53e782a

Please sign in to comment.