Class: Attached::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/attached/job.rb

Class Method Summary collapse

Class Method Details

.enqueue(attachment) ⇒ Object



12
13
14
15
16
17
# File 'lib/attached/job.rb', line 12

def self.enqueue(attachment)
  klass = attachment.instance.class.name
  id = attachment.instance.id
  method = attachment.name
  attachment.status = 'processing'
end

.perform(klass, id, method) ⇒ Object



5
6
7
8
9
10
# File 'lib/attached/job.rb', line 5

def self.perform(klass, id, method)
  object = eval(klass).find(id)
  attachment = object.send(name)
  attachment.reprocess!
  attachment.status = 'active'
end