2014-10-01 54 views
0

我试图从新安装的rails版本去。创建项目并根据我使用rails搭建的模型迁移数据库。我遇到了一个不知道如何构建任务'db :: migrate'的错误。Rake中止:不知道如何在安装rails后迁移

命令我跑..

删除所有宝石:
for i in 'gem list --no-versions'; do gem uninstall -aIx $i; done

安装导轨和创建新项目的
sudo gem install rails
rails new test-api
rails generate controller user index
rails generate model user name:string

所以这是我的设置..

然后我做的方法迁移我的数据库:
rake db::migrate

这里是我的输出:

rake db::migrate 
rake aborted! 
Don't know how to build task 'db::migrate' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `block in load' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency' 
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:241:in `load' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/command_wrapper.rb:40:in `call' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:180:in `block in serve' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:153:in `fork' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:153:in `serve' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application.rb:122:in `run' 
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>' 
-e:1:in `<main>' 
(See full trace by running task with --trace) 

回答

0

我找到了解决办法。如果我只是更新我的服务器上我的网页,我会发现这一点:

enter image description here

这给了我答案,只是运行此命令:

bin/rake db:migrate RAILS_ENV=development 
相关问题