I have a model that uses paperclips for image attachments
I currently require that the attachment be an image using a validation
validates_attachment_content_type :image, :content_type => /^image\/(jpg|jpeg|pjpeg|png|x-png|gif)$/, :message => 'file type is not allowed (only jpeg/png/gif images)'
However when I try to upload a non-image I get these error messages.
Image /var/folders/1f/0jtzzpl56sdcb92spkx6rpch0000gn/T/10-21-201120120908-44073-j59q0s.pdf is not recognized by the 'identify' command.
Image /var/folders/1f/0jtzzpl56sdcb92spkx6rpch0000gn/T/10-21-201120120908-44073-j59q0s.pdf is not recognized by the 'identify' command.
Image content type file type is not allowed (only jpeg/png/gif images)
So it seems like the file is being passed to ImageMagick even though the file does not pass the validation. I want the last error message only and not the first 2.
How can I either suppress the two first messages or make sure that the file is not processed unless it passes the content type validation?
Solved with