reset st_commits before setting new value to prevent error when old st_commits is broken

This commit is contained in:
Dmitriy Zaporozhets 2013-04-02 11:32:41 +03:00
parent d3559e2556
commit af657b0509

View file

@ -172,6 +172,12 @@ class MergeRequest < ActiveRecord::Base
def reloaded_commits
if opened? && unmerged_commits.any?
# we need to reset st_commits field first
# in order to prevent internal rails comparison
self.st_commits = []
save
# Then we can safely write unmerged commits
self.st_commits = unmerged_commits
save
end