has_attachment and validation


I would like call the validation when the user submit a file only. i tested this

validates_as_attachment unless self.uploaded_data.blank?

NoMethodError in EnseignantsController#create

undefined method `uploaded_data' for Enseignant:Class

But no Working`

Can you help me thanks you


thanks you for quick answer

the error

SyntaxError in EnseignantsController#index

/Users/bmichelin/Documents/Perso/uag-histoire/site-web/app/models/ enseignant.rb:32: syntax error, unexpected kEND, expecting '}'

Just peek at the source. It's a simple method that calls 2 validations. Call them manually any custom way you want.


I have to correct the syntaxe. And now i have this error

ArgumentError in EnseignantsController#index

wrong number of arguments (1 for 0)

I got this to work with a combination of your methods. All of the below code went straight into my model that used attachment_fu