0
在我的rails3應用程序中,我有一個debitnote控制器,模型和由腳手架創建的視圖。 我告訴你遷移:如何自動生成唯一的debitnote編號
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
高清self.down drop_table:debitnotes 結束 結束
在我的應用我想自動生成一個唯一的debitnote號碼時用戶打開新的形式創建deb