0
我想創建一個種子文件,我需要填寫一些:日期字段,但我得到引發ArgumentError:無效的日期當我運行耙分貝:這裏的種子是我的種子代碼的摘錄:播種期對象
d1 = DateTime.new(2015,22,06)
d2 = DateTime.new(2015,11,06)
d3 = DateTime.new(2015,28,06)
Event.create!([{
name: "Test Event NC",
start_on: d1,
finish_on: d1,
certificate: false,
free: true,
ven: false,
capacity: 100,
address: "3250 1st Ave 350",
client: px
}])
和我的數據庫架構
create_table "events", force: :cascade do |t|
t.string "name"
t.date "start_on"
t.date "finish_on"
t.boolean "certificate"
t.boolean "free"
t.boolean "ven"
t.integer "capacity"
t.text "address"
t.integer "client_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
如何填充任何想法:日期字段?感謝
男人,我以爲我寫了這樣的論據!多麼愚蠢的錯誤,謝謝 – cromanelli