Class: SequencescapeExcel::SpecialisedField::ControlType
- Inherits:
-
Object
- Object
- SequencescapeExcel::SpecialisedField::ControlType
- Includes:
- Base
- Defined in:
- app/sequencescape_excel/sequencescape_excel/specialised_field/control_type.rb
Overview
Sets both control and control_type fields on the sample
Direct Known Subclasses
Instance Attribute Summary
Attributes included from Base
#sample_manifest_asset, #value
Instance Method Summary collapse
Methods included from Base
Instance Method Details
#check_control_type_matches_enum ⇒ Object
24 25 26 27 28 |
# File 'app/sequencescape_excel/sequencescape_excel/specialised_field/control_type.rb', line 24 def check_control_type_matches_enum return if value.blank? || Sample.control_types.include?(value) errors.add(:base, "the control type #{value} was not recognised.") end |
#update(_attributes = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/sequencescape_excel/sequencescape_excel/specialised_field/control_type.rb', line 12 def update(_attributes = {}) return unless valid? if value.present? sample.control = true sample.control_type = value else sample.control = false sample.control_type = nil end end |