lib/backgrounder/workers/process_asset.rb in carrierwave_backgrounder-0.2.2 vs lib/backgrounder/workers/process_asset.rb in carrierwave_backgrounder-0.3.0
- old
+ new
@@ -1,33 +1,19 @@
# encoding: utf-8
module CarrierWave
module Workers
- class ProcessAsset < Struct.new(:klass, :id, :column)
- def self.perform(*args)
- new(*args).perform
- end
+ class ProcessAsset < Base
def perform(*args)
- set_args(*args) if args.present?
- record = constantized_resource.find id
+ record = super(*args)
if record
record.send(:"process_#{column}_upload=", true)
if record.send(:"#{column}").recreate_versions! && record.respond_to?(:"#{column}_processing")
record.update_attribute :"#{column}_processing", nil
end
end
- end
-
- private
-
- def set_args(klass, id, column)
- self.klass, self.id, self.column = klass, id, column
- end
-
- def constantized_resource
- klass.is_a?(String) ? klass.constantize : klass
end
end # ProcessAsset
end # Workers