Class: Heron::Factories::Tube
- Inherits:
-
Object
- Object
- Heron::Factories::Tube
- Includes:
- ActiveModel::Model, Concerns::ForeignBarcodes
- Defined in:
- app/models/heron/factories/tube.rb
Overview
Factory class to generate sample tubes inside a Heron rack
Instance Attribute Summary collapse
-
#sample_tube ⇒ Object
Returns the value of attribute sample_tube.
Instance Method Summary collapse
-
#create ⇒ Object
Persists the material including the associated container.
Methods included from Concerns::ForeignBarcodes
#barcode_format, #check_barcode_format, #check_foreign_barcode_unique, included
Instance Attribute Details
#sample_tube ⇒ Object
Returns the value of attribute sample_tube.
11 12 13 |
# File 'app/models/heron/factories/tube.rb', line 11 def sample_tube @sample_tube end |
Instance Method Details
#create ⇒ Object
Persists the material including the associated container
15 16 17 18 19 20 21 22 |
# File 'app/models/heron/factories/tube.rb', line 15 def create return unless valid? @sample_tube = SampleTube.create! Barcode.create!(labware_id: @sample_tube.id, barcode: , format: ) @sample_tube end |