Sha256: f18e7ed9ab99a0ce5ebefaa5d7a905ba511a057476590e050add6be3546cd29e
Contents?: true
Size: 887 Bytes
Versions: 4
Compression:
Stored size: 887 Bytes
Contents
# encoding: utf-8 module CarrierWave module Workers module ProcessAssetMixin include CarrierWave::Workers::Base def self.included(base) base.extend CarrierWave::Workers::ClassMethods end def perform(*args) record = super(*args) asset = record.send(:"#{column}") return unless record && asset_present?(asset) recreate_asset_versions!(asset) if record.respond_to?(:"#{column}_processing") record.update_attribute :"#{column}_processing", false end end private def recreate_asset_versions!(asset) asset.is_a?(Array) ? asset.map(&:recreate_versions!) : asset.recreate_versions! end def asset_present?(asset) asset.is_a?(Array) ? asset.present? : asset.file.present? end end # ProcessAssetMixin end # Workers end # Backgrounder
Version data entries
4 entries across 4 versions & 1 rubygems