Class: Workers::ProcessPhoto

Inherits:
Base
  • Object
show all
Defined in:
app/workers/process_photo.rb

Instance Method Summary collapse

Instance Method Details

#perform(id) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
# File 'app/workers/process_photo.rb', line 12

def perform(id)
  photo = Photo.find(id)
  unprocessed_image = photo.unprocessed_image

  return false if photo.processed? || unprocessed_image.path.try(:include?, ".gif")

  photo.processed_image.store!(unprocessed_image)

  photo.save!
rescue ActiveRecord::RecordNotFound # Deleted before the job was run
end