add files validations to models

This commit is contained in:
kara Diaby 2020-03-16 17:55:16 +01:00
parent 84c54f7271
commit 1f27652cd3
6 changed files with 39 additions and 7 deletions

View file

@ -10,9 +10,8 @@ class AttestationTemplate < ApplicationRecord
has_one_attached :signature
validates :footer, length: { maximum: 190 }
validates :logo, content_type: [:png, :jpg, :jpeg]
validates :signature, content_type: [:png, :jpg, :jpeg]
validates :logo, content_type: ['image/png', 'image/jpg', 'image/jpeg'], size: { less_than: 1.megabytes }
validates :signature, content_type: ['image/png', 'image/jpg', 'image/jpeg'], size: { less_than: 1.megabytes }
DOSSIER_STATE = Dossier.states.fetch(:accepte)