Method: Effective::Asset#process!

Defined in:
app/models/effective/asset.rb

#process!Object Also known as: reprocess!

This method is called asynchronously by an after_commit filter



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'app/models/effective/asset.rb', line 189

def process!
  if placeholder?
    puts 'Placeholder Asset processing not required (this is a soft error)'
    # Do nothing
  elsif image? == false
    puts 'Non-image Asset processing not required'
    # Do Nothing
  elsif upload_file.include?(Effective::Asset.string_base_path)
    puts 'String-based Asset processing and uploading'
    data.recreate_versions!
  elsif upload_file.include?(Effective::Asset.s3_base_path)
    # Carrierwave must download the file, process it, then upload the generated versions to S3
    puts 'S3 Uploaded Asset downloading and processing'

    self.remote_data_url = url
  else
    puts 'Non S3 Asset downloading and processing'
    puts "Downloading #{upload_file}"

    self.remote_data_url = upload_file
  end

  self.processed = true
  save!
end