1

I have my rails app filled with about 30000 products from various suppliers. Currently each product image_url is being hosted by individual suppliers. How would I go about saving each image from the image_url to my rackspace account, and make sure that each image_url generated by rackspace is assigned to the correct product.

Yogzzz
  • 2,735
  • 5
  • 36
  • 56

1 Answers1

0

You could put this in a Rake task if you already have all the files and know which objects they should be associated with.

For each product,

  1. Upload the image
  2. Change the image_url
  3. Validate the upload + the model name
  4. Save the model

If you need to keep track of which are processed or not, you could either add a field in the model, or keep an array of processed Models until the task is complete.

fdsaas
  • 714
  • 4
  • 10