raise if trying to del a user who can't be deleted
This commit is contained in:
parent
696a058280
commit
0f881f942b
3 changed files with 6 additions and 9 deletions
|
@ -101,6 +101,10 @@ class User < ApplicationRecord
|
|||
end
|
||||
|
||||
def delete_and_keep_track_dossiers(administration)
|
||||
if !can_be_deleted?
|
||||
raise "Cannot delete this user because instruction has started for some dossiers"
|
||||
end
|
||||
|
||||
if can_be_deleted?
|
||||
dossiers.each do |dossier|
|
||||
dossier.delete_and_keep_track(administration)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue