I would like to create a Rails controller that downloads a series of jpg files from the Internet and directly writes them to the database as binary (I'm not trying to download a form)
Any clue on how to do this?
thanks
Edit: Here is the code I already wrote using the -fu gem prefix:
http = Net::HTTP.new('awebsite', 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE http.start() { |http| req = Net::HTTP::Get.new("image.jpg") req.basic_auth login, password response = http.request(req) attachment = Attachment.new(:uploaded_data => response.body) attachement.save }
And I get the undefined method `content_type 'for #" error
ruby ruby-on-rails
Chris
source share