您好,当我想rake db:seed
在我的控制台出现此唯一的消息导轨 - 通过Spring预加载过程8773运行 - 在我的控制台
通过弹簧预加载在进程中运行8773
待办事项你我该如何创造我的种子?当我将它部署到heroku master时,它不会出现?
这里是种子:
rails = Course.create(title: "Ruby On Rails")
models = rails.chapters.create(title: "Models")
models.items << Lesson.create(title: "What is Active Record?", content: "Lesson content here")
models.items << Exercise.create(title: "The Active Record pattern", content: "Exo about active record pattern")
models.items << Exercise.create(title: "Object Relational Mapping", content: "Exo about ORM")
models.items << Exercise.create(title: "Active Record as an ORM Framework", content: "Exo about ORM")
models.items << Lesson.create(title: "Convention over Configuration in Active Record", content: "Lesson content here")
models.items << Exercise.create(title: "Naming Conventions", content: "Exo about naming convention")
models.items << Exercise.create(title: "Schema Conventions", content: "Exo about schema convention")
models.items << Lesson.create(title: "Model summary", content: "Lesson content here")
models.items << Exam.create(title: "Rails Models exam", content: "Exam content here")
我想将它保存修复它的第一期培训班,并删除它摧毁它,当我完成了最后的版本。我试图推动它heroku但种子消失。你知道为什么吗?
转到db/seeds.rb并把它放在底部''puts puts“done”'''。现在重新运行您的命令以确认种子未运行 – MilesStanfield
它的工作原理@MilesStanfield。 –