Skip to content

Commit

Permalink
view.rb: #update_head handles situation when there is no previous ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
Oleg Andreev committed Apr 27, 2008
1 parent 7d27f84 commit 1503e7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/strokedb/views/view.rb
Expand Up @@ -179,8 +179,8 @@ def update(doc)
# Remove a previous version, add a new one.
#
def update_head(doc) #:nodoc
prev = doc.versions.previous # FIXME: handle situation with no previous version
old_pairs = map_with_encoding(prev.uuid, prev)
prev = doc.versions.previous
old_pairs = prev ? map_with_encoding(prev.uuid, prev) : []
new_pairs = map_with_encoding(doc.uuid, doc)
storage.replace(old_pairs, new_pairs)
end
Expand Down

0 comments on commit 1503e7c

Please sign in to comment.