Archive only when path changes owner

This commit is contained in:
Paul Chavard 2018-09-07 17:43:21 +01:00
parent be51802983
commit 2770f1db82

View file

@ -23,7 +23,7 @@ class ProcedurePath < ApplicationRecord
end
def publish!(new_procedure)
if procedure&.publiee?
if procedure&.publiee? && procedure != new_procedure
procedure.archive!
end
update!(procedure: new_procedure)