Class: SequenceGenerator::Sequence
Constant Summary
ActsAsSequenced::ColumnWithSamePurposeExists, ActsAsSequenced::DEFAULT_OPTIONS
Instance Method Summary
collapse
included
Instance Method Details
#generate_sequence_number ⇒ Object
12
13
14
15
16
17
|
# File 'app/models/sequence_generator/sequence.rb', line 12
def generate_sequence_number
sequence_number = "%06d" % (sequential_id + 1).to_s
generated_sequential_id = "#{sequence_prefix}#{sequence_number}"
self.update(sequential_id: sequential_id + 1)
return generated_sequential_id
end
|
#validate_sequential_id ⇒ Object
8
9
10
|
# File 'app/models/sequence_generator/sequence.rb', line 8
def validate_sequential_id
validates_presence_of :sequential_id, :purpose
end
|