Drop procedure dossiers when updating brouillon
This commit is contained in:
parent
3be678dbe5
commit
7237ff80cc
8 changed files with 63 additions and 13 deletions
|
@ -109,6 +109,14 @@ class Procedure < ApplicationRecord
|
|||
dossiers.update_all(hidden_at: now)
|
||||
end
|
||||
|
||||
def reset!
|
||||
if locked?
|
||||
raise "Can not reset a locked procedure."
|
||||
else
|
||||
dossiers.delete_all
|
||||
end
|
||||
end
|
||||
|
||||
def locked?
|
||||
publiee_ou_archivee?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue