Carrierwave thumb方法不适用于远程图像URL

时间:2016-01-21 09:42:48

标签: ruby-on-rails activeadmin carrierwave

我有一个模型有两个字段img_file(从计算机加载)和img_url(从Internet远程加载)。我的ulpoader中有一个标准的拇指方法。

 version :thumb do
   process :resize_to_fit => [50, 50]
 end

问题在于,当我为img_file调用此方法时,它可以正常工作,但不适用于img_url。

这是我的代码:

f.inputs do
   f.input :project_id, as: :select, collection: Project.all {|p| [p.title]}
   f.input :img_file, as: :file, hint: image_tag(f.object.img_file.thumb)
   f.input :img_url
end

这就是我为两者调用thumb方法的方法:

column :img_file do |photo|
  image_tag photo.img_file.thumb
end

column :img_url do |photo|
  image_tag photo.img_url.thumb
end

这似乎是一个愚蠢的问题,但我坚持不懈。希望,任何人都能看到问题。谢谢!

0 个答案:

没有答案