I'm using the Paperclip gem for Rails in order to allow users to upload a photo of themselves. I obviously only want to accept jpeg
, gif
or png
images. What is the proper way to validate these files were uploaded instead of something else like a word document?
According to the Paperclip docs, I validate content-type with:
validates_attachment :document, content_type: "application/pdf"
What is the proper way to validate the above different image formats (gif
, png
, jpeg
)?
validates_attachment_content_type :image,
should bevalidates_attachment_content_type :document
– Nadeau