write a concern to add a garantueed unique and sequential invoice number to an active record model
Here is an example of a concern that adds a guaranteed unique and sequential invoice number to an ActiveRecord model:
module InvoiceNumberable
extend ActiveSupport::Concern
included do
before_create :generate_invoice_number