Sha256: e86c15c9b661fcea59b0e4e2a4f73efb8b2e9d70b057af65e0aa6e043749fd1b
Contents?: true
Size: 732 Bytes
Versions: 1
Compression:
Stored size: 732 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 } ## # 生成下一个序列号。如: # Unidom::Sequence::Sequence.generate! 'ODNO', '20200101' # # or # Unidom::Sequence::Sequence.generate! 'ODNO' 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 unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Sequence::Sequence'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-sequence-1.0 | app/models/unidom/sequence/sequence.rb |