heroku paperclip weird error Paperclip::Errors::MissingRequiredValidatorError

Itai Sagi picture Itai Sagi · Feb 2, 2014 · Viewed 9.4k times · Source

I've deployed a rails app to heroku, it was working just fine until I changed domains, locally it works fine and now I've started getting the following error: Paperclip::Errors::MissingRequiredValidatorError.

the s3 env variables are set on heroku and I can't find why this error occurs, help is appreciated.

EDIT: for future reference, it had nothing to do with heroku, once re-bundling, it'll throw the same error locally, as the answer suggest.

Answer

sebvst picture sebvst · Feb 2, 2014

With version 4.0 (published 2 days ago) Paperclip requires file/mime validation. Simply add the following to your model:

validates_attachment_content_type :file_name, :content_type => %w(image/jpeg image/jpg image/png)

IMPORTANT: replace file_name and content type so that it fits your project.

It works locally because you probably have not updated paperclip yet.