这是我的模型迁移
class CreateSwimmingClassschedules < ActiveRecord::Migration
def change
create_table :swimming_classschedules do |t|
t.integer :slot_id
t.integer :coach_id
t.integer :level_id , :default => 1
t.string :note
t.timestamps
end
end
end
我期待在我打电话后
Swimming::Classchedule.create(:coach_id=>8)
它将在表中生成一个默认的 level_id。但不知何故,它不起作用。我在使用 SQLite 的开发环境中。
我添加了
:default => 1
我跑了之后
rake db:migrate
有关系吗?我错过了什么?