Class Method never call
- From: Bolo <malavoi@xxxxxxxxx>
- Date: 30 Apr 2007 04:53:25 -0700
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
.
- Prev by Date: Re: Array.which_long? ( I coded an extension for Array )
- Next by Date: Re: Array.which_long? ( I coded an extension for Array )
- Previous by thread: Ruby date conversion
- Next by thread: Problem with RoR's controller getting too large
- Index(es):