2016-09-27 148 views
2

我一直在寻找解决方案来解决我的问题,并没有任何运气。我是一名初级用户,遵循一个教程,我达到了必须运行命令'rake db:migrate'并不断收到错误的地步。rake db:迁移错误(迁移正在进行中)

$ rake db:migrate 
== 20160927120721 CreateTodoItems: migrating ================================== 
-- create_table(:todo_items) 
rake aborted! 
StandardError: An error has occurred, this and all later migrations canceled: 

undefined method `refrences' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x0055d8b19b8298> 
Did you mean? references 
/home/paul/todo/db/migrate/20160927120721_create_todo_items.rb:5:in `block in change' 
/home/paul/todo/db/migrate/20160927120721_create_todo_items.rb:3:in `change' 
NoMethodError: undefined method `refrences' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x0055d8b19b8298> 
Did you mean? references 
/home/paul/todo/db/migrate/20160927120721_create_todo_items.rb:5:in `block in change' 
/home/paul/todo/db/migrate/20160927120721_create_todo_items.rb:3:in `change' 
Tasks: TOP => db:migrate 
(See full trace by running task with --trace) 

我试图重新耙“耙分贝:重置”,但它告诉我,有一个挂起的迁移,并尝试“耙分贝:迁移”。我也试过'rake db:drop''gem update rake''bundle update rake''bunlde exec rake db:migrate'并且仍然没有运气。有人可以帮助我吗?我对所有这些都很新,所以如果还有更多我可以发布,请让我知道,这样我就可以继续发展和学习!提前致谢!!

Ubuntu的16.04LTS
滑轨4.2.6
红宝石2.3.1p112(2016年4月26日修订版54768)[x86_64的Linux的]

+1

变化'refrences'到'references'就像铁轨的建议给你。 – fanta

回答

4

变化refrences20160927120721_create_todo_items.rb在第5行到有效references如你的错误说。

总是仔细阅读Rails的例外 - 他们通常是信息性的。

+0

哇哈哈学习的痛苦,我想,但非常感谢你 – paulkiio

+0

@ paulkiio请务必接受答案(左侧选中标记),如果这解决了你的问题。每个问题只能接受一个答案。 –

2

在你20160927120721_create_todo_items.rb文件你有输错refrences,将其更改为引用