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

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#current_dataObject

Method provided for backwards compatibility



42
43
44
# File 'app/models/qc_file.rb', line 42

def current_data
  uploaded_data.read
end

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

Yields:

  • (uploaded_data)


46
47
48
49
50
51
52
53
54
55
# File 'app/models/qc_file.rb', line 46

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