lib/backgrounder/workers/process_asset.rb in carrierwave_backgrounder-0.1.2 vs lib/backgrounder/workers/process_asset.rb in carrierwave_backgrounder-0.1.3
- old
+ new
@@ -8,24 +8,28 @@
def self.perform(*args)
new(*args).perform
end
def perform(*args)
- set_args(*args) unless args.empty?
- resource = klass.is_a?(String) ? klass.constantize : klass
- record = resource.find id
+ set_args(*args) if args.present?
+ record = constantized_resource.find id
if record
record.send(:"process_#{column}_upload=", true)
if record.send(:"#{column}").recreate_versions! && record.respond_to?(:"#{column}_processing")
- record.send :"#{column}_processing=", nil
- record.save!
+ 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