From aae26a863a0bac3915cf61782738fc0cbb48d2a8 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 25 Jan 2024 17:29:39 +0100 Subject: [PATCH] perf(admin#dashboard): skip validation of PJ --- app/models/type_de_champ.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 281274a82..5b60124f0 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -190,8 +190,8 @@ class TypeDeChamp < ApplicationRecord end has_one_attached :piece_justificative_template - validates :piece_justificative_template, size: { less_than: FILE_MAX_SIZE } - validates :piece_justificative_template, content_type: AUTHORIZED_CONTENT_TYPES + validates :piece_justificative_template, size: { less_than: FILE_MAX_SIZE }, on: :update + validates :piece_justificative_template, content_type: AUTHORIZED_CONTENT_TYPES, on: :update has_one_attached :notice_explicative validates :notice_explicative, content_type: [ @@ -206,7 +206,7 @@ class TypeDeChamp < ApplicationRecord "image/jpg", "image/png", "text/plain" - ], size: { less_than: 20.megabytes } + ], size: { less_than: 20.megabytes }, on: :update validates :libelle, presence: true, allow_blank: false, allow_nil: false validates :type_champ, presence: true, allow_blank: false, allow_nil: false