Update procedure path attribute when procedure_path changes

This commit is contained in:
Paul Chavard 2018-09-13 18:34:01 +02:00
parent b772256a97
commit b042efdcba

View file

@ -107,6 +107,7 @@ class Procedure < ApplicationRecord
else else
create_procedure_path!(administrateur: administrateur, path: path) create_procedure_path!(administrateur: administrateur, path: path)
end end
update!(path: path)
end end
def reset! def reset!
@ -385,12 +386,12 @@ class Procedure < ApplicationRecord
end end
def after_archive def after_archive
update!(archived_at: Time.now) update!(archived_at: Time.now, path: nil)
end end
def after_hide def after_hide
now = Time.now now = Time.now
update!(hidden_at: now) update!(hidden_at: now, path: nil)
procedure_path&.hide! procedure_path&.hide!
dossiers.update_all(hidden_at: now) dossiers.update_all(hidden_at: now)
end end