This commit is contained in:
Toks
2015-09-09 00:20:19 -04:00
parent 1de52791f3
commit aa9deb26e8

View File

@@ -161,12 +161,12 @@ class Note < ActiveRecord::Base
def create_version def create_version
CurrentUser.user.increment!(:note_update_count) CurrentUser.user.increment!(:note_update_count)
Note.where(:id => id).update_all("version = coalesce(version, 0) + 1")
reload
if merge_version? if merge_version?
merge_version merge_version
else else
Note.where(:id => id).update_all("version = coalesce(version, 0) + 1")
reload
create_new_version create_new_version
end end
end end
@@ -194,8 +194,7 @@ class Note < ActiveRecord::Base
:width => width, :width => width,
:height => height, :height => height,
:is_active => is_active, :is_active => is_active,
:body => body, :body => body
:version => versions.where("id <> ?", prev.id).maximum(:version) || 1
) )
end end