您好,當我想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。 –