Class: AssetBarcode
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- AssetBarcode
- Defined in:
- app/models/asset_barcode.rb
Overview
This class only a concurrency safe counter to generate asset barcode Used for tubes
Class Method Summary collapse
-
.new_barcode(prefix = Tube.default_prefix) ⇒ String
Generate a new Sanger barcode, namespaced with the given prefix.
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
Class Method Details
.new_barcode(prefix = Tube.default_prefix) ⇒ String
Note:
The returned string does NOT include the prefix.
Generate a new Sanger barcode, namespaced with the given prefix
15 16 17 18 19 20 21 22 23 |
# File 'app/models/asset_barcode.rb', line 15 def self.(prefix = Tube.default_prefix) = AssetBarcode.create!.id while Barcode.find_by(barcode: SBCF::SangerBarcode.from_prefix_and_number(prefix, ).) = AssetBarcode.create!.id end .to_s end |