Class: Zizia::CsvManifestUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Defined in:
app/uploaders/zizia/csv_manifest_uploader.rb

Instance Method Summary collapse

Instance Method Details

#cache_dirObject



18
19
20
# File 'app/uploaders/zizia/csv_manifest_uploader.rb', line 18

def cache_dir
  manifests_cache_path || Rails.root.join('tmp', 'csv_uploads_cache')
end

#errorsObject

These are stored in memory only, not persisted



30
31
32
# File 'app/uploaders/zizia/csv_manifest_uploader.rb', line 30

def errors
  @validator ? @validator.errors : []
end

#extension_whitelistObject

Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:

%w(jpg jpeg gif png)


25
26
27
# File 'app/uploaders/zizia/csv_manifest_uploader.rb', line 25

def extension_whitelist
  %w[csv]
end

#recordsObject



39
40
41
# File 'app/uploaders/zizia/csv_manifest_uploader.rb', line 39

def records
  @validator ? @validator.record_count : 0
end

#store_dirObject

The directory where the csv manifest will be stored.



14
15
16
# File 'app/uploaders/zizia/csv_manifest_uploader.rb', line 14

def store_dir
  manifests_path || Rails.root.join('tmp', 'csv_uploads')
end

#warningsObject

These are stored in memory only, not persisted



35
36
37
# File 'app/uploaders/zizia/csv_manifest_uploader.rb', line 35

def warnings
  @validator ? @validator.warnings : []
end