Module: SequenceGenerator::Generator
- Defined in:
- lib/sequence_generator/extender.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/sequence_generator/extender.rb', line 20 def self.included(base) def generate_sequence() return if send([:column]).present? sequence = Sequence.find_by!(purpose: [:purpose], scope: send([:scope])) assign_attributes([:column]=> sequence.generate_next(, self)) end end |
Instance Method Details
#generate_sequence(options) ⇒ Object
21 22 23 24 25 |
# File 'lib/sequence_generator/extender.rb', line 21 def generate_sequence() return if send([:column]).present? sequence = Sequence.find_by!(purpose: [:purpose], scope: send([:scope])) assign_attributes([:column]=> sequence.generate_next(, self)) end |