开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜