Class: CarrierWave::Workers::StoreAsset
- Defined in:
- lib/backgrounder/workers/store_asset.rb
Instance Attribute Summary collapse
-
#cache_path ⇒ Object
readonly
Returns the value of attribute cache_path.
-
#tmp_directory ⇒ Object
readonly
Returns the value of attribute tmp_directory.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Instance Attribute Details
#cache_path ⇒ Object (readonly)
Returns the value of attribute cache_path.
6 7 8 |
# File 'lib/backgrounder/workers/store_asset.rb', line 6 def cache_path @cache_path end |
#tmp_directory ⇒ Object (readonly)
Returns the value of attribute tmp_directory.
6 7 8 |
# File 'lib/backgrounder/workers/store_asset.rb', line 6 def tmp_directory @tmp_directory end |
Instance Method Details
#perform(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/backgrounder/workers/store_asset.rb', line 8 def perform(*args) record = super(*args) if record.send(:"#{column}_tmp") store_directories(record) record.send :"process_#{column}_upload=", true record.send :"#{column}_tmp=", nil record.send :"#{column}_processing=", nil 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 |