2010-10-21 75 views

回答

0

你可以給出一個代碼示例,說明如何配置模型以接受附件?

基本上,要上傳其他圖像以外的圖像,您需要省略:content_type選項或提供正確的內容類型。

所以不是(例如):

has_attachment :content_type => :image, :max_size => 5.megabytes 

您需要提供類似:

has_attachment :content_type => 'application/pdf', :max_size => 5.megabytes 

或只是has_attachment沒有:content_type(這將接受所有類型)。

查看attachemnt_fu README瞭解更多示例。

相關問題