From aa9deb26e8abc130527a1cbbb102228d90f3abd8 Mon Sep 17 00:00:00 2001 From: Toks Date: Wed, 9 Sep 2015 00:20:19 -0400 Subject: [PATCH] fixes #2512, fixes #2513 --- app/models/note.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/note.rb b/app/models/note.rb index 30d37df8e..81bba616b 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -161,12 +161,12 @@ class Note < ActiveRecord::Base def create_version CurrentUser.user.increment!(:note_update_count) - Note.where(:id => id).update_all("version = coalesce(version, 0) + 1") - reload if merge_version? merge_version else + Note.where(:id => id).update_all("version = coalesce(version, 0) + 1") + reload create_new_version end end @@ -194,8 +194,7 @@ class Note < ActiveRecord::Base :width => width, :height => height, :is_active => is_active, - :body => body, - :version => versions.where("id <> ?", prev.id).maximum(:version) || 1 + :body => body ) end