Procedure: Once deliberation or cadre_juridique have been set, forbid unsetting them
This commit is contained in:
parent
b998425005
commit
c72421fb9e
2 changed files with 33 additions and 0 deletions
|
@ -48,6 +48,8 @@ class Procedure < ApplicationRecord
|
|||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||
validate :check_juridique
|
||||
|
||||
before_save :update_juridique_required
|
||||
|
||||
include AASM
|
||||
|
||||
aasm whiny_persistence: true do
|
||||
|
@ -343,6 +345,11 @@ class Procedure < ApplicationRecord
|
|||
|
||||
private
|
||||
|
||||
def update_juridique_required
|
||||
self.juridique_required ||= (cadre_juridique.present? || deliberation.attached?)
|
||||
true
|
||||
end
|
||||
|
||||
def clone_attachment(cloned_procedure, attachment_symbol)
|
||||
attachment = send(attachment_symbol)
|
||||
if attachment.attached?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue