Module: DelayedPaperclip
- Defined in:
- lib/delayed_paperclip.rb,
lib/delayed_paperclip/railtie.rb,
lib/delayed_paperclip/version.rb,
lib/delayed_paperclip/attachment.rb,
lib/delayed_paperclip/process_job.rb,
lib/delayed_paperclip/url_generator.rb
Defined Under Namespace
Modules: Attachment, ClassMethods, Glue, InstanceMethods
Classes: ProcessJob, Railtie, UrlGenerator
Constant Summary
collapse
- VERSION =
"3.1.1"
Class Method Summary
collapse
Class Method Details
.enqueue(instance_klass, instance_id, attachment_name) ⇒ Object
22
23
24
|
# File 'lib/delayed_paperclip.rb', line 22
def enqueue(instance_klass, instance_id, attachment_name)
processor.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name)
end
|
.options ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/delayed_paperclip.rb', line 9
def options
@options ||= {
:background_job_class => DelayedPaperclip::ProcessJob,
:url_with_processing => true,
:processing_image_url => nil,
:queue => "paperclip"
}
end
|
.process_job(instance_klass, instance_id, attachment_name) ⇒ Object
26
27
28
29
30
31
32
33
|
# File 'lib/delayed_paperclip.rb', line 26
def process_job(instance_klass, instance_id, attachment_name)
instance = instance_klass.constantize.unscoped.where(id: instance_id).first
return if instance.blank?
instance.
send(attachment_name).
process_delayed!
end
|
.processor ⇒ Object
18
19
20
|
# File 'lib/delayed_paperclip.rb', line 18
def processor
options[:background_job_class]
end
|