| Issue 231: | doesn't set rank for new images |
‹ Prev
229 of 229
|
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem? 1. upload an image 2. detect the newly uploaded image's product_image rank -- it's nil |
diff --git a/app/controllers/admin/products_controller.rb b/app/controllers/admin/products_controller.rb index 0bcd19b..962ea23 100644 --- a/app/controllers/admin/products_controller.rb +++ b/app/controllers/admin/products_controller.rb @@ -264,6 +264,9 @@ class Admin::ProductsController < Admin::BaseController new_image.uploaded_data = i[:image_data] if new_image.save @product.images << new_image + product_image = new_image.reload.product_images[0] + product_image.rank = @product.reload.next_image_rank_to_use + product_image.save else image_errors.push(new_image.filename + " " + new_image.errors.map{|e| e.to_s}.join(' ')) end perhaps? (see other patches on the ML FWIW) :)