demarches-normaliennes/app/models/champs/piece_justificative_champ.rb

25 lines
654 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2018-02-13 18:18:20 +01:00
class Champs::PieceJustificativeChamp < Champ
FILE_MAX_SIZE = 200.megabytes
2024-05-07 16:41:20 +02:00
has_many_attached :piece_justificative_file
# TODO: if: -> { validate_champ_value? || validation_context == :prefill }
validates :piece_justificative_file,
size: { less_than: FILE_MAX_SIZE },
if: -> { !type_de_champ.skip_pj_validation }
2021-01-18 12:34:52 +01:00
validates :piece_justificative_file,
content_type: AUTHORIZED_CONTENT_TYPES,
if: -> { !type_de_champ.skip_content_type_pj_validation }
def main_value_name
:piece_justificative_file
end
def search_terms
# We dont know how to search inside documents yet
end
2018-02-13 18:18:20 +01:00
end