Module: QcFile::Associations

Included in:
Plate, Tube
Defined in:
app/models/qc_file.rb

Instance Method Summary collapse

Instance Method Details

#has_qc_filesObject

Adds accessors for named fields and attaches documents to them


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/qc_file.rb', line 8

def has_qc_files
  class_eval do
    has_many :qc_files, foreign_key: :asset_id, dependent: :destroy

    def add_qc_file(file, filename = nil)
      opts = { uploaded_data: { tempfile: file, filename: filename } }
      opts[:filename] = filename unless filename.nil?
      qc_files.create!(opts) if file.present?
    end

    def update_qc_values_with_parser(_parser)
      true
    end
  end
end