rake db:迁移错误以生成模型

时间:2017-04-05 15:21:29

标签: ruby-on-rails

使用rails后生成模型电子邮件:字符串名称:字符串我得到了rake db:migrate

的错误
rake db:migrate
rake aborted!
ArgumentError: Missing :controller key on routes definition, please check your routes.
/home/abhishek/RubymineProjects/untitled/config/routes.rb:2:in `block in <top (required)>'
/home/abhishek/RubymineProjects/untitled/config/routes.rb:1:in `<top (required)>'
/home/abhishek/RubymineProjects/untitled/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

2 个答案:

答案 0 :(得分:1)

这不是创建模型的正确命令语法

rails generate model email:string name:string

请改用:

rails generate model ModelName email:string name:string

然后使用

rake db:migrate

答案 1 :(得分:0)

迁移没有问题。问题出在您的routes.rb文件中。你能否在这里提供你的routes.rb文件。