How can I save a image with an image url in ruby?


#1

I would like to have a copy of an image file locally given an image url.
like this
def loadimage=(image_url)
…how to fetch image from an url…
File.open("#{RAILS_ROOT}/public/images/#{file.original_filename}",
“w+”) do |f|
f.write file.read
end
end

Anyone could refer any existing helper with the function I need?

Thanks