2017-05-27 78 views
0

我需要附上味精文件軌道,我有添加的MIME類型的MSG文件類型回形針上傳失敗的MSG文件類型

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) 

有什麼建議嗎?我正在使用回形針5.1.0

回答

0

什麼是導軌驗證錯誤?

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

閱讀導致回滾的保存錯誤,從那裏你會知道它被拒絕的原因。