Validates commentaire file size

This commit is contained in:
Mathieu Magnin 2017-11-08 16:38:07 +01:00
parent 76cb54988d
commit 6c39aba978
2 changed files with 6 additions and 0 deletions

View file

@ -4,6 +4,7 @@ class Commentaire < ActiveRecord::Base
belongs_to :piece_justificative belongs_to :piece_justificative
mount_uploader :file, CommentaireFileUploader mount_uploader :file, CommentaireFileUploader
validates :file, file_size: { maximum: 20.megabytes, message: "La taille du fichier doit être inférieure à 20 Mo" }
validate :is_virus_free? validate :is_virus_free?
default_scope { order(created_at: :asc) } default_scope { order(created_at: :asc) }

View file

@ -0,0 +1,5 @@
fr:
activerecord:
attributes:
commentaire:
file: fichier