Sha256: 237b93212a4ff592afe82f8034b77c03e1ca6d2770966fc577a7b2cb734a24c0
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
require 'delayed_job' module DelayedPaperclip module Jobs class DelayedJob < Struct.new(:instance_klass, :instance_id, :attachment_name) if Gem.loaded_specs['delayed_job'].version >= Gem::Version.new("2.1.0") # this is available in newer versions of DelayedJob. Using the newee Job api thus. def self.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name) ::Delayed::Job.enqueue( :payload_object => new(instance_klass, instance_id, attachment_name), :priority => instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:priority].to_i, :queue => instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:queue] ) end else def self.enqueue_delayed_paperclip(instance_klass, instance_id, attachment_name) ::Delayed::Job.enqueue( new(instance_klass, instance_id, attachment_name), instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:priority].to_i, instance_klass.constantize.paperclip_definitions[attachment_name][:delayed][:queue] ) end end def perform DelayedPaperclip.process_job(instance_klass, instance_id, attachment_name) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems