Module: SampleManifestExcel::Tags::AliquotUpdater

Extended by:
ActiveSupport::Concern
Included in:
SequencescapeExcel::SpecialisedField::I5, SequencescapeExcel::SpecialisedField::I7
Defined in:
app/sample_manifest_excel/sample_manifest_excel/tags/aliquot_updater.rb

Overview

AliquotUpdater TODO: Add specific tests

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#update(attributes = {}) ⇒ Object


21
22
23
24
25
26
27
28
29
30
# File 'app/sample_manifest_excel/sample_manifest_excel/tags/aliquot_updater.rb', line 21

def update(attributes = {})
  return unless valid?

  tag = if value.present?
          attributes[:tag_group].tags.find_or_create_by(oligo: value) do |t|
            t.map_id = attributes[:tag_group].tags.count + 1
          end
        end
  attributes[:aliquot].send("#{tag_name}=", tag)
end