Sha256: 82a762b25911141ab10f10ebf076833ec43f98e89d21707f6f323dd405806574

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

##
# Sequence ζ˜―εΊεˆ—γ€‚

class Unidom::Sequence::Sequence < Unidom::Sequence::ApplicationRecord

  self.table_name = 'unidom_sequences'

  include Unidom::Common::Concerns::ModelExtension

  scope :prefix_is, ->(prefix) { where prefix: prefix }

  def self.generate!(sequentiality_code, prefix = '')
    sequence = prefix_is(prefix).sequentiality_coded_as(sequentiality_code).valid_at.alive.first_or_create!
    sequence.increment! :serial_number
    sequence.serial_number
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-sequence-0.2.1 app/models/unidom/sequence/sequence.rb