在 rails console (RAILS_ENV=production) 中调用 photo.image.recreate_versions!
时报错,错误信息如下:
NoMethodError: undefined method `content_type' for #<CarrierWave::Storage::UpYun::File:0x00000005bc84c8>
from carrierwave-0.5.8/lib/carrierwave/uploader/cache.rb:74:in `cache_stored_file!'
from carrierwave-0.5.8/lib/carrierwave/uploader/versions.rb:179:in `recreate_versions!'
请问这是又拍云的问题,还是 carrierwave-upyun 的问题?据说使用 Mongoid 的 GridFS 也会有同样的情况,大家有没有遇到过呢?
class Photo < ActiveRecord::Base
mount_uploader :image, PhotoUploader
end
class PhotoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :upyun
version :thumb do
process :resize_and_pad => [150, 150, '#000']
end
version :thumb_wide do
process :resize_and_pad => [230, 143, '#000']
end
end