Validate Attachment Content Type Paperclip
Is it possible to enforce a 'content type' validation in paperclip without enforcing a 'presence' validation (i.e. allow blanks)? I currently have: class Person < ActiveRecord::Base has_attached_file :picture validates_attachment_content_type :picture, :content_type => ['image/jpeg', 'image/jpg', 'image/png'] end However, this fails if no attachment is present. For example: >> @person = Person.new >> @person.save >> @person.errors.first => ["picture_content_type", "is not one of image/jpeg, image/jpg, image/png"] Is it possible to do the validation only if an attachment is included. I'm not