Module: SampleManifestExcel::Tags::AliquotUpdater
- Extended by:
- ActiveSupport::Concern
- 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 31 |
# 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] . .find_or_create_by(oligo: value) { |t| t.map_id = attributes[:tag_group]..count + 1 } end aliquots.each { |aliquot| aliquot.assign_attributes(tag_name => tag) } end |