Class: TubeRack::Purpose

Inherits:
Purpose show all
Defined in:
app/models/tube_rack/purpose.rb

Overview

The purpose of a tube rack is to hold tubes. Created to hold the size of the tube rack for use when generating manifests.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Purpose

#barcode_type, #prefix=, #set_default_barcode_prefix, #source_plate, #source_plates, #source_purpose_name=, #target_class

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods included from SharedBehaviour::Named

included

Methods included from Purpose::Relationship::Associations

included

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

extended

Class Method Details

.standard_tube_rackObject

[View source]

13
14
15
# File 'app/models/tube_rack/purpose.rb', line 13

def self.standard_tube_rack
  TubeRack::Purpose.find_by(name: 'TR Stock 96')
end

Instance Method Details

#create!(*args) ⇒ Object

Creates the tube rack with the given attributes, setting the purpose and size.

[View source]

18
19
20
21
22
23
# File 'app/models/tube_rack/purpose.rb', line 18

def create!(*args, &)
  options = args.extract_options!
  options[:purpose] = self
  options[:size] = size
  target_class.create!(*args, options, &).tap { |tr| tube_racks << tr }
end