Paperclip - attachment validations
Using Paperclip, if you need to check if your model has an attachment, you don't use the standard ActiveRecord validation helper i.e.;
validates_presence_of :logo
Erroneous!
Instead you use Paperclip's helper
validates_attachment_presence :logo
But be sure to put that after your attachment definition
has_attached_file :logo
validates_attachment_presence :logo
And if you're doing something tricky, like allowing your model to be saved without an attachment first, but enforcing that an attachment is present on update then;
validates_attachment_presence :logo, :unless => :new_record?
Posted by Glenn Roberts



