【发布时间】:2017-02-05 05:24:41
【问题描述】:
我一直在寻找解决问题的方法,但没有任何运气。我是一个遵循教程的初学者,我已经到了必须运行命令“rake db:migrate”并不断收到错误的地步。
$ 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:reset”重置 rake,但它告诉我有一个待定迁移并尝试“rake db:migrate”。我还尝试了 'rake db:drop' 'gem update rake' 'bundle update rake' 'bunlde exec rake db:migrate' 仍然没有运气。有人可以帮助我吗?我对这一切都很陌生,所以如果还有什么我可以发布的,请告诉我,这样我才能继续成长和学习!提前致谢!!
Ubuntu 16.04LTS
Rails 4.2.6
ruby 2.3.1p112(2016-04-26 修订版 54768)[x86_64-linux]
【问题讨论】:
-
将
refrences更改为references,就像 rails 给你的建议一样。
标签: ruby-on-rails ruby activerecord rubygems