错误是当您尝试运行bundle exec rake db:seed时在标题中看到的错误。
我的种子文件:
#1
Board_Game.create(
title: "5 Second Rule",
base_game: "",
min_players: 3,
max_players: "",
time_needed: 20,
company: "Patch",
)
#2
Board_Game.create(
title: "7 Wonders",
base_game: "",
min_players: 2,
max_players: 7,
time_needed: 30,
company: "Repos Production",
)
#3
Board_Game.create(
title: "7 Wonders Babel",
base_game: 2,
min_players: 2,
max_players: 7,
time_needed: 40,
company: "Repos Production",
)
#4
Board_Game.create(
title: "Alhambra",
base_game: "",
min_players: 2,
max_players: 6,
time_needed: 45,
company: "Queen Games",
)
#5
Board_Game.create(
title: "Agricola",
base_game: "",
min_players: 1,
max_players: 5,
time_needed: 30,
company: "Z-Man Games",
)
#6
Board_Game.create(
title: "Agricola: Farmers of the Moor",
base_game: 5,
min_players: 1,
max_players: 5,
time_needed: 30,
company: "Z-Man Games",
)
#7
Board_Game.create(
title: "Arkham Horror",
base_game: "",
min_players: 1,
max_players: 8,
time_needed: 120,
company: "Fantasy Flight Games",
)
#8
Board_Game.create(
title: "Ascending Empires",
base_game: "",
min_players: 2,
max_players: 4,
time_needed: 75,
company: "Z-Man Games",
)
#9
Board_Game.create(
title: "Ascension: Chronicle of the Godslayer",
base_game: "",
min_players: 2,
max_players: 4,
time_needed: 30,
company: "Gary Games",
)
#10
Board_Game.create(
title: "Ascension: Storm of Souls",
base_game: "",
min_players: 1,
max_players: 4,
time_needed: 30,
company: "Gary Games",
)
#11
Board_Game.create(
title: "Bootleggers",
base_game: "",
min_players: 3,
max_players: 6,
time_needed: 90,
company: "Mayday Games",
)
#12
Board_Game.create(
title: "Carcassonne",
base_game: "",
min_players: 2,
max_players: 5,
time_needed: 35,
company: "Z-Man Games",
)
#13
Board_Game.create(
title: "Cash 'n Guns",
base_game: "",
min_players: 4,
max_players: 8,
time_needed: 30,
company: "Repos Production",
)
#14
Board_Game.create(
title: "Camel Cup",
base_game: "",
min_players: 2,
max_players: 8,
time_needed: 20,
company: "Pegasus Spiele",
)
#15
Board_Game.create(
title: "Castles of Mad King Ludwig",
base_game: "",
min_players: 1,
max_players: 4,
time_needed: 90,
company: "Bézier Games",
)
#16
Board_Game.create(
title: "Caverna: the Cave Farmers",
base_game: "",
min_players: 1,
max_players: 7,
time_needed: 30,
company: "MayFair Games",
)
#17
Board_Game.create(
title: "Codenames",
base_game: "",
min_players: 2,
max_players: 8,
time_needed: 15,
company: "Czech Games Edition",
)
#18
Board_Game.create(
title: "Dead of Winter",
base_game: "",
min_players: 2,
max_players: 5,
time_needed: 60,
company: "Plaid Hat Games",
)
#19
Board_Game.create(
title: "Mistborn: House War",
base_game: "",
min_players: 3,
max_players: 5,
time_needed: 60,
company: "Crafty",
)
#20
Board_Game.create(
title: "Nefertiti",
base_game: "",
min_players: 3,
max_players: 4,
time_needed: 45,
company: "Rio Grande Games",
)
puts "database seeded"
我的board_game.rb:
class BoardGame < ApplicationRecord
end
在尝试使用棋盘游戏库等建立用户之前,我只是想播种一些棋盘游戏,但是我不确定该模型出了什么问题。我现在大约一个月都没有编程,在此之前还只是参加了Web开发新手训练营,所以我是菜鸟。谢谢!
答案 0 :(得分:1)
该类称为BoardGame
,因此您应该在种子文件中使用BoardGame.create