Class: Heron::Factories::Tube

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Concerns::ForeignBarcodes

#barcode_format, #check_barcode_format, #check_foreign_barcode_unique, included

Instance Attribute Details

#sample_tubeObject

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

#createObject

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: barcode, format: barcode_format)

  @sample_tube
end