ADD FILE_MAX_SIZE constant to set allow file size limit
This commit is contained in:
parent
bda3270b58
commit
bdbb4deb87
7 changed files with 23 additions and 16 deletions
|
@ -24,9 +24,10 @@ class Commentaire < ApplicationRecord
|
|||
|
||||
validates :body, presence: { message: "ne peut être vide" }
|
||||
|
||||
FILE_MAX_SIZE = 20.megabytes
|
||||
validates :piece_jointe,
|
||||
content_type: AUTHORIZED_CONTENT_TYPES,
|
||||
size: { less_than: 20.megabytes }
|
||||
size: { less_than: FILE_MAX_SIZE }
|
||||
|
||||
default_scope { order(created_at: :asc) }
|
||||
scope :updated_since?, -> (date) { where('commentaires.updated_at > ?', date) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue