2016-09-27 111 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,將其更改爲引用