]> git.openstreetmap.org Git - rails.git/blobdiff - lib/tasks/upgrade_avatars.rake
Return absolute URLs for user images
[rails.git] / lib / tasks / upgrade_avatars.rake
index 03939dad84b7575522e31295bf278d2f5855290a..0466609ffb3c3573989387e59f8b5fe566cd26f3 100644 (file)
@@ -1,6 +1,8 @@
 namespace "storage" do
   task :upgrade_avatars => :environment do
     User.active.where.not(:image_file_name => nil).in_batches.each_record do |user|
+      next if user.avatar.attached?
+
       io = File.open(user.image.path)
       filename = user.image.original_filename
       content_type = if user.image.content_type.nil?