我有一个安装 Carrierwave 上传器的简单模型。在开发中一切正常,但我得到一个未定义的方法“image_will_change!” heroku 上的错误。
class Receipt < ActiveRecord::Base
mount_uploader :image, ImageUploader
end
class ImageUploader < CarrierWave::Uploader::Base
storage :fog
def store_dir
"receipts/saved"
end
end
根据 Carrierwave Wiki,我也正确设置了 cache_dir。
receipt.image = File.open "public/images/test.jpg" #works fine in development, fails in heroku