我有以下文件上传器
class ItemImageUploader < CarrierWave::Uploader::Base
include ::CarrierWave::Backgrounder::Delay
include CarrierWave::MiniMagick
include Sprockets::Helpers::RailsHelper
include Sprockets::Helpers::IsolatedHelper
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
def default_url
asset_path("fallback/" + [version_name, "image.png"].compact.join('_'))
end
def cache_dir
"uploads/tmp"
end
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_fill => [80,80]
end
def extension_white_list
%w(jpg jpeg gif png)
end
图片类
class Picture < ActiveRecord::Base
belongs_to :imageable, :polymorphic => true
mount_uploader :image, ItemImageUploader
process_in_background :image
validates_presence_of :image
def copy
Picture.new(:image => self.image)
end
以及carrier_wave.rb 初始化文件中的以下配置:
CarrierWave.configure do |config|
config.enable_processing = true
#config.permissions = 0666
#config.directory_permissions = 0777
config.storage = :file
end
图片已正确上传,但未创建缩略图,未发生错误。请指教。