Class: SpecificTubeRackCreation
- Inherits:
-
AssetCreation
- Object
- ActiveRecord::Base
- ApplicationRecord
- AssetCreation
- SpecificTubeRackCreation
- Defined in:
- app/models/specific_tube_rack_creation.rb
Overview
Allows for the creation of multiple tube racks and their tubes. rubocop:disable Metrics/ClassLength
Defined Under Namespace
Classes: ChildPurpose, ChildTubeRack
Constant Summary collapse
- DEFAULT_TARGET_TYPE =
'TubeRack'
Instance Attribute Summary collapse
-
#tube_rack_attributes ⇒ Object
If no tube rack attributes are specified, fall back to an empty array.
Instance Method Summary collapse
-
#multiple_purposes ⇒ Object
See asset_creation, flag to indicate that multiple child purposes are expected and skip validation.
-
#parent ⇒ Object
singular 'parent' getter to stay backwards compatible.
-
#parent=(parent) ⇒ Object
singular 'parent' setter to stay backwards compatible.
Methods inherited from AssetCreation
Methods included from Asset::Ownership::ChangesOwner
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
Instance Attribute Details
#tube_rack_attributes ⇒ Object
If no tube rack attributes are specified, fall back to an empty array
73 74 75 |
# File 'app/models/specific_tube_rack_creation.rb', line 73 def tube_rack_attributes @tube_rack_attributes || Array.new(child_purposes.length, {}) end |
Instance Method Details
#multiple_purposes ⇒ Object
See asset_creation, flag to indicate that multiple child purposes are expected and skip validation
78 79 80 |
# File 'app/models/specific_tube_rack_creation.rb', line 78 def multiple_purposes true end |
#parent ⇒ Object
singular 'parent' getter to stay backwards compatible
63 64 65 |
# File 'app/models/specific_tube_rack_creation.rb', line 63 def parent parents.first end |
#parent=(parent) ⇒ Object
singular 'parent' setter to stay backwards compatible
68 69 70 |
# File 'app/models/specific_tube_rack_creation.rb', line 68 def parent=(parent) self.parents = [parent] end |