【发布时间】:2014-09-29 08:18:15
【问题描述】:
有以下型号:
class Picture < ActiveRecord::Base
belongs_to :business
has_attached_file :image, styles: { medium: "640x260>" }
validates_attachment :image, content_type: { :content_type => /\Aimage\/.*\Z/ }
end
我还使用 brew 安装了“imagemagick”(我使用 Mac OS)。但是当我试图执行以下代码时
@picture = business.pictures.build(picture_params)
@picture.save
def picture_params
params.require(:picture).permit(:image)
end
我收到以下错误:An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
我正在尝试更新 PNG 文件:
= form_for [:admin, business, @picture] do |f|
.row
= f.file_field :image
= f.submit 'Add'
如何解决我的问题?
【问题讨论】: