执行 ProductImage.last.picture_url.recreate_versions!
返回错误:TypeError: no implicit conversion of nil into String
rvm/gems/ruby-2.3.0@camp/gems/carrierwave-0.10.0/lib/carrierwave/uploader/cache.rb:83:in `initialize'
class ProductImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
include Concerns::Uploader
if CarrierwaveSetting.status == 'open'
storage CarrierwaveSetting.storage.to_sym
else
storage :file
end
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def filename
original_filename
end
version :thumb_500_500 do
process resize_and_pad: [500, 500]
end
def extension_white_list
%w{bmp png jpeg jpg gif}
end
def store_from_url(url)
file_path = Aliexpress::Image.download url
File.open file_path do |file|
self.store! file
end
end
end