add files validations to models
This commit is contained in:
parent
84c54f7271
commit
1f27652cd3
6 changed files with 39 additions and 7 deletions
|
@ -10,6 +10,8 @@ class Avis < ApplicationRecord
|
|||
|
||||
validates :email, format: { with: Devise.email_regexp, message: "n'est pas valide" }, allow_nil: true
|
||||
validates :claimant, presence: true
|
||||
validates :piece_justificative_file, size: { less_than: 20.megabytes }
|
||||
validates :introduction_file, size: { less_than: 20.megabytes }
|
||||
|
||||
before_validation -> { sanitize_email(:email) }
|
||||
before_create :try_to_assign_instructeur
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue