Module: AttachmentProcessing

Extended by:
ActiveSupport::Concern
Included in:
ActAsAttachedFile
Defined in:
app/models/concerns/attachment_processing.rb

Instance Method Summary collapse

Instance Method Details

#delayed_file_processingObject

DELAYED JOB



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/models/concerns/attachment_processing.rb', line 33

def delayed_file_processing
  if is_image? && image_processing
    self.image_processing = false
    job = DelayedImageProcessor.new(self)

    job.perform
    # Delayed::Job.enqueue job, queue: :image_processing, run_at: Proc.new { 10.seconds.from_now }
  else
    # if it's not image
    # Upload file and recalculate
    recalculate_storage_counters!
  end
end

#set_processing_flagsObject



25
26
27
28
29
30
# File 'app/models/concerns/attachment_processing.rb', line 25

def set_processing_flags
  if is_image?
    self.processing       = :processing
    self.image_processing = true
  end
end