0

I need to attach the msg file to rails, i have add the mime type for the msg filetype

validates_attachment :file, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif", "application/pdf","application/vnd.ms-excel",     
         "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
         "application/msword",
         "application/vnd.ms-outlook", 
         "application/octet-stream",
         "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 
         "text/plain"] }

but when upload with the sample msg file it went error

Command :: file -b --mime '/tmp/5e8ff9bf55ba3508199d22e984129be620170527-6239-gqgnhz.msg'
Command :: file -b --mime '/tmp/5e8ff9bf55ba3508199d22e984129be620170527-6239-g903st.msg'
(0.2ms)  ROLLBACK
Completed 500 Internal Server Error in 26ms (ActiveRecord: 1.7ms)

any suggestion? i am using paperclip 5.1.0

alfitra
  • 27
  • 7

1 Answers1

0

what is the rails validation error?

if object.save
  ... 
else 
  logger.debug object.errors.inspect 
end

Read the save error that cause rollback, from there you'll know the reason it were rejected.

Yakob Ubaidi
  • 1,846
  • 2
  • 20
  • 23