Dossier without user should be valid
This commit is contained in:
parent
c38bfedb80
commit
3f7a2bea9b
2 changed files with 4 additions and 3 deletions
|
@ -87,7 +87,7 @@ class Dossier < ApplicationRecord
|
|||
|
||||
belongs_to :groupe_instructeur, optional: true
|
||||
belongs_to :revision, class_name: 'ProcedureRevision', optional: false
|
||||
belongs_to :user, optional: false
|
||||
belongs_to :user, optional: true
|
||||
|
||||
has_one :procedure, through: :revision
|
||||
has_many :types_de_champ, through: :revision
|
||||
|
@ -349,7 +349,7 @@ class Dossier < ApplicationRecord
|
|||
after_save :send_web_hook
|
||||
after_create_commit :send_draft_notification_email
|
||||
|
||||
validates :user, presence: true
|
||||
validates :user, presence: true, if: -> { deleted_user_email_never_send.nil? }
|
||||
validates :individual, presence: true, if: -> { revision.procedure.for_individual? }
|
||||
validates :groupe_instructeur, presence: true, if: -> { !brouillon? }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue