Fix rubocop warning

This commit is contained in:
Tom Hughes 2019-07-15 21:18:13 +01:00
parent 6dd451c7ee
commit d2d3f2c9fd

View file

@ -1,7 +1,8 @@
namespace "storage" do
task :upgrade_avatars => :environment do
User.active.where.not(:image_file_name => nil).in_batches.each_record do |user|
unless user.avatar.attached?
next if user.avatar.attached?
io = File.open(user.image.path)
filename = user.image.original_filename
content_type = if user.image.content_type.nil?
@ -13,5 +14,4 @@ namespace "storage" do
user.avatar.attach(:io => io, :filename => filename, :content_type => content_type)
end
end
end
end