parent
b927ab4568
commit
a08f170dbd
11 changed files with 39 additions and 25 deletions
|
@ -2,6 +2,9 @@ class Commentaire < ApplicationRecord
|
|||
belongs_to :dossier, touch: true
|
||||
belongs_to :piece_justificative
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :gestionnaire
|
||||
|
||||
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?
|
||||
|
@ -16,6 +19,16 @@ class Commentaire < ApplicationRecord
|
|||
super.reject { |c| c.name == "champ" }
|
||||
end
|
||||
|
||||
def email
|
||||
if user
|
||||
user.email
|
||||
elsif gestionnaire
|
||||
gestionnaire.email
|
||||
else
|
||||
read_attribute(:email)
|
||||
end
|
||||
end
|
||||
|
||||
def header
|
||||
"#{sender}, #{I18n.l(created_at, format: '%d %b %Y %H:%M')}"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue