diff --git a/lib/tasks/export_data.rake b/lib/tasks/export_data.rake index c396254..1c18f6c 100644 --- a/lib/tasks/export_data.rake +++ b/lib/tasks/export_data.rake @@ -98,7 +98,8 @@ task :export_model_images, [:vendorname] => :environment do |t, args| if m.images.count > 0 ### no need if separately done - m.images.sorted.first.file.reprocess! + first_image = m.images.sorted.first + first_image.file.reprocess! dirpath = path + "#{vendorslug}" if !Dir.exists?(dirpath) @@ -109,10 +110,10 @@ task :export_model_images, [:vendorname] => :environment do |t, args| Dir.mkdir(dirpath) end begin - m.images.sorted.first.file.copy_to_local_file(:icon, path + iconfilepath) - m.images.sorted.first.file.copy_to_local_file(:thumbnail, path + thumbfilepath) - m.images.sorted.first.file.copy_to_local_file(:original, path + originalfilepath) - puts " - Image downloaded (" + m.images.sorted.first.file.url + ")" + first_image.file.copy_to_local_file(:icon, path + iconfilepath) + first_image.file.copy_to_local_file(:thumbnail, path + thumbfilepath) + first_image.file.copy_to_local_file(:original, path + originalfilepath) + puts " - Image downloaded (" + first_image.file.url + ")" assets_bucket.objects.create(iconfilepath, Pathname.new(path + iconfilepath)) assets_bucket.objects.create(thumbfilepath, Pathname.new(path + thumbfilepath))