Validate body is present
This commit is contained in:
parent
6c39aba978
commit
4d12aa222c
3 changed files with 12 additions and 2 deletions
|
@ -6,6 +6,7 @@ class Commentaire < ActiveRecord::Base
|
|||
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?
|
||||
validates_presence_of :body, message: "Votre message ne peut être vide"
|
||||
|
||||
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