我需要将msg文件附加到rails,我已经为msg文件类型添加了mime类型
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"] }
但是当使用示例msg文件上传时,它出错了
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)
有什么建议吗?我正在使用paperclip 5.1.0
答案 0 :(得分:0)
什么是rails验证错误?
if object.save
...
else
logger.debug object.errors.inspect
end
阅读导致回滚的保存错误,从那里您就知道它被拒绝的原因。