how to generate a unique debitnote number automatically
in my rails3 app i have a debitnote controller ,model and views created by scaffold. i show you the migration:
开发者_StackOverflow社区class CreateDebitnotes < ActiveRecord::Migration
def self.up
create_table :debitnotes do |t|
t.string :debit_note_number
t.date :date
t.decimal :amount, :precision =>18, :scale => 2
t.string :debit_account_of
t.string :debit_for
t.text :description
t.timestamps
end
end
def self.down drop_table :debitnotes end end
in my app i want to automatically generate a unique debitnote number when user open new form to create a deb
You may use UUID generator github repo
精彩评论