rails download remote file to temp file
require 'tempfile' require 'open-uri' def download(url) file = Tempfile.new(['foobar','.jpg']) file.binmode file.write(open(url).read) file.close return file.path end download("https://koenig-media.raywenderlich.com/uploads/2016/08/Puppy.jpg")