lib/backgrounder/orm/base.rb in carrierwave_backgrounder-0.0.7 vs lib/backgrounder/orm/base.rb in carrierwave_backgrounder-0.0.8
- old
+ new
@@ -48,19 +48,11 @@
def set_#{column}_processing
self.#{column}_processing = true if respond_to?(:#{column}_processing)
end
def enqueue_#{column}_background_job
- if defined? ::GirlFriday
- CARRIERWAVE_QUEUE << { :worker => #{worker}.new(self.class.name, id, #{column}.mounted_as) }
- elsif defined? ::Delayed::Job
- ::Delayed::Job.enqueue #{worker}.new(self.class.name, id, #{column}.mounted_as)
- elsif defined? ::Resque
- ::Resque.enqueue #{worker}, self.class.name, id, #{column}.mounted_as
- elsif defined? ::Qu
- ::Qu.enqueue #{worker}, self.class.name, id, #{column}.mounted_as
- end
+ CarrierWave::Backgrounder.enqueue_for_backend(#{worker}, self.class.name, id.to_s, #{column}.mounted_as)
end
def trigger_#{column}_background_processing?
process_#{column}_upload != true
end
@@ -96,26 +88,18 @@
class_eval <<-RUBY, __FILE__, __LINE__ + 1
attr_accessor :process_#{column}_upload
def write_#{column}_identifier
super() and return if process_#{column}_upload
- self.#{column}_tmp = _mounter(:#{column}).cache_name
+ self.#{column}_tmp = _mounter(:#{column}).cache_name if _mounter(:#{column}).cache_name
end
def store_#{column}!
super() if process_#{column}_upload
end
def enqueue_#{column}_background_job
- if defined? ::GirlFriday
- CARRIERWAVE_QUEUE << { :worker => #{worker}.new(self.class.name, id, #{column}.mounted_as) }
- elsif defined? ::Delayed::Job
- ::Delayed::Job.enqueue #{worker}.new(self.class.name, id, #{column}.mounted_as)
- elsif defined? ::Resque
- ::Resque.enqueue #{worker}, self.class.name, id, #{column}.mounted_as
- elsif defined? ::Qu
- ::Qu.enqueue #{worker}, self.class.name, id, #{column}.mounted_as
- end
+ CarrierWave::Backgrounder.enqueue_for_backend(#{worker}, self.class.name, id.to_s, #{column}.mounted_as)
end
def trigger_#{column}_background_storage?
process_#{column}_upload != true
end