0

I have a model with two fields img_file (to load from computer) and img_url (to load remotely from internet). I have a standart thumb method in my ulpoader.

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

The problem is that, when I call this method for img_file it works, but doesn't for img_url.

Here is my code:

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

This is how I call thumb method for both:

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

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

It seems to be a silly question, but I'm stuck with. Hope, anyone see the problem. Thanks!

Daria Voronova
  • 123
  • 2
  • 9
  • I think it's coming from the naming you've used `img_url` specifically the `_url` part. Just to be sure rename it to something else and check again. – mtkcs Jan 21 '16 at 10:06
  • @Marwen, thanks for your reply! I've renamed it to img_remote, but now when I call thumb method, it says **undefined method `thumb' for #** – Daria Voronova Jan 21 '16 at 10:35
  • You have to replace `img_url` by `img_remote` everywhere in your code. Also try with a newly created `record` after updating you `migration` – mtkcs Jan 21 '16 at 10:55
  • @Marwen, I renamed it everywhere, migrated, but it still not working. So strange... – Daria Voronova Jan 21 '16 at 11:04
  • After renaming, did you get the same `error` or a new one? – mtkcs Jan 21 '16 at 11:09
  • @Marwen, the same error **undefined method `thumb' for # – Daria Voronova Jan 21 '16 at 11:18
  • Okay, I found an answer that might help you. http://stackoverflow.com/questions/5007575/how-to-assign-a-remote-file-to-carrierwave – mtkcs Jan 21 '16 at 11:28

0 Answers0