未定义的方法`image_will_change!'在Heroku上为CarrierWave [英] Undefined method `image_will_change!' for CarrierWave on Heroku

查看:182
本文介绍了未定义的方法`image_will_change!'在Heroku上为CarrierWave的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个装载Carrierwave上传器的简单模型。一切工作正常,但我得到一个未定义的方法image_will_change!错误在heroku上。

I have a simple model that mounts a Carrierwave uploader. Everything works fine in development, but I get an undefined method "image_will_change!" error on 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。

I have the cache_dir set appropriately as well according to the Carrierwave Wiki.

receipt.image = File.open "public/images/test.jpg" #works fine in development, fails in heroku


推荐答案

很可能您的数据库在heroku上没有收据表中的图像列。

It's likely that your db on heroku doesn't have the image column in the receipts table.

这篇关于未定义的方法`image_will_change!'在Heroku上为CarrierWave的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆