lib/paperweight/post_process_job.rb in paperweight-1.0.2 vs lib/paperweight/post_process_job.rb in paperweight-1.1.0

- old
+ new

@@ -6,13 +6,21 @@ queue_as :default discard_on ActiveJob::DeserializationError def perform(model, name) - processing = :"#{name}_processing" - image_url = model.public_send(processing) + name = AttachmentName.new(name) + image_url = model.public_send(name.processing) return unless image_url - model.update!(name => Download.download(image_url), processing => nil) + + model.update!( + name.name => Download.download(image_url), + name.processing => nil + ) + + return unless model.respond_to?(name.after_download) + + model.public_send(name.after_download) end end end