validates_attachment_presence not working

6 views
Skip to first unread message

Marcus Mansur

unread,
Nov 4, 2009, 2:09:28 PM11/4/09
to Paperclip Plugin
Hi, my avatar model has_attached_file :attach,
:styles => {:original => "70x77"},
:path => ":rails_root/public/uploads/
avatar/:id.:extension",
:url => "/uploads/avatar/:id.:extension"

and validates_attachment_presence :attach

but when i do something like this:

a = Avatar.new
a.save

the record is saved :O

Neil Brown

unread,
Nov 13, 2009, 10:23:03 AM11/13/09
to Paperclip Plugin
I have the same problem. My model has:

has_attached_file :blob
validates_attachment_presence :blob, :message => "No file uploaded"

But when I create a new instance of the model without uploading a
file, the validation passes. This is with paperclip version 2.3.1.1.
Is there a workaround - can I write my own validation to check if a
file has actually been supplied?
Reply all
Reply to author
Forward
0 new messages