Class: Firefly::CodeFactory
- Inherits:
-
Object
- Object
- Firefly::CodeFactory
- Includes:
- DataMapper::Resource
- Defined in:
- lib/firefly/code_factory.rb
Class Method Summary collapse
-
.next_code! ⇒ Object
Returns the next auto increment value and updates the counter.
Class Method Details
.next_code! ⇒ Object
Returns the next auto increment value and updates the counter
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/firefly/code_factory.rb', line 11 def self.next_code! code = nil Firefly::CodeFactory.transaction do c = Firefly::CodeFactory.first code = Firefly::Base62.encode(c.count + 1) c.update(:count => c.count + 1) end code end |