2
我按照官方的github倉庫例子,但是當我定義的版本方法的情況下,我總是得到:Carrierwave條件版本拋出參數錯誤
ArgumentError - wrong number of arguments (1 for 0):
(gem) carrierwave-0.8.0/lib/carrierwave/uploader/versions.rb:198:in `block in active_versions'
(gem) carrierwave-0.8.0/lib/carrierwave/uploader/versions.rb:192:in `active_versions'
這裏我的代碼:
class PhotoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
version :thumb_75, :if => :is_user? do
process :resize_to_fill => [75, 75]
end
version :thumb_87, :if => :is_question? do
process :resize_to_fill => [87, 87]
end
protected
def is_user?
model.class.to_s == 'Photo'
end
protected
def is_question?
model.class.to_s == 'Question'
end
end
如果我刪除它的工作條件... 任何想法可能是什麼? 感謝
完美!這解決了我的問題!謝謝:-) – Gozup
它不適合我,我在發育中途停下了某個地方。 – ratnakar
他們應該更新文檔來澄清這一點。這並不明顯。只是似乎好奇,他們包括該方法的參數。 – anothercoder