Class: QcFile

Inherits:
ApplicationRecord show all
Extended by:
DbFile::Uploader
Includes:
Uuid::Uuidable
Defined in:
app/models/qc_file.rb

Defined Under Namespace

Modules: Associations

Instance Method Summary collapse

Methods included from DbFile::Uploader

extended, has_uploaded

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#current_dataObject

Method provided for backwards compatibility


37
38
39
# File 'app/models/qc_file.rb', line 37

def current_data
  uploaded_data.read
end

#retrieve_file {|uploaded_data| ... } ⇒ Object

Yields:

  • (uploaded_data)

41
42
43
44
45
46
47
48
49
# File 'app/models/qc_file.rb', line 41

def retrieve_file
  uploaded_data.cache!(uploaded_data.file)
  yield(uploaded_data)
  # We can't actually delete the cache file here, as the send_file
  # operation happens asynchronously. Instead we can use:
  # PolymorphicUploader.clean_cached_files!
  # This cleans the last 24h worth of files, so should be a daily
  # cron
end