Class Method never call

Hello,

I don’t understand why ma méthode validates_as_attachment is never
call when the object is save or update
Can you help me

Thanks

class Enseignant < ActiveRecord::Base

self.keep_translations_in_model = true
translates :recherche, :publication, :personal

has_many :contributions
has_many :enseignements, :through => :contributions
has_one :user

validates_presence_of :nom, :prenom
has_attachment :storage => :file_system,
:content_type => :image,
:path_prefix => “uplaod/#{table_name}”,
:max_size => 500.kilobytes,
:resize_to => ‘250x250>’

def validate
self.class.validates_as_attachment

self.class.validates_as_attachment unless filename.blank?

end

def adress(lanque)
#chargement du fichier de configuration
adresse = YAML::load(IO.read("#{RAILS_ROOT}/db/adresses.yml"))
return adresse[self.adresse+"_"+lanque]
end

def adresses
adresse = YAML::load(IO.read("#{RAILS_ROOT}/db/adresses.yml"))
return adresse[‘adresses’]
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs