class PaperclipReprocessWorker
include Sidekiq::Worker
sidekiq_options retry: true
def perform(klass, group)
group.each do |id|
klass.constantize.attachment_definitions.keys.each do |attachment|
begin
klass.constantize.find(id).send(attachment).reprocess!
print "."
rescue Errno::ENOENT
puts "File not found for #{klass} with id #{id}."
puts "#{$!}\n\n"
rescue Paperclip::Error
puts "Paperclip Error for #{klass} with id #{id}."
puts "#{$!}\n\n"
end
end
end
end
end