Sha256: a88830909def52f263ebd1b7c29f82c5bb13f7140da65c27121f0acd356297cd
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# encoding: utf-8 module CarrierWave module Workers class StoreAsset < Base attr_reader :cache_path, :tmp_directory def perform(*args) record = super(*args) if record && record.send(:"#{column}_tmp") store_directories(record) record.send :"process_#{column}_upload=", true record.send :"#{column}_tmp=", nil record.send :"#{column}_processing=", false if record.respond_to?(:"#{column}_processing") File.open(cache_path) { |f| record.send :"#{column}=", f } if record.save! FileUtils.rm_r(tmp_directory, :force => true) end end end private def store_directories(record) asset, asset_tmp = record.send(:"#{column}"), record.send(:"#{column}_tmp") cache_directory = File.expand_path(asset.cache_dir, asset.root) @cache_path = File.join(cache_directory, asset_tmp) @tmp_directory = File.join(cache_directory, asset_tmp.split("/").first) end end # StoreAsset end # Workers end # Backgrounder
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
carrierwave_backgrounder-0.4.2 | lib/backgrounder/workers/store_asset.rb |
carrierwave_backgrounder-0.4.1 | lib/backgrounder/workers/store_asset.rb |