'rails generate model…' returns nothing

落爺英雄遲暮 提交于 2019-12-12 05:25:07

问题


So I'm currently following this tutorial: http://net.tutsplus.com/tutorials/ruby/how-to-use-omniauth-to-authenticate-your-users/

And are suck on Step 5. I managed to do step 4 which uses the generate command to create a new controller file. Now I need to create a model for User with name and email as attributes. having typed in:

'rails generate model User name:string email:string'

It just hangs for a couple seconds before returning nothing and just providing me access to the command line again. (running windows 7)

I don't know if I'm missing something, I've installed gems for sqlite3 and activeRecord,not that I think this should be a issue.

I'm totally lost as it doesn't give me any information back and doesn't create the files I expect. I am typing these commands from within my application directory C:\user\steve\documents\gitrepositories\AppName


回答1:


I think the tutorial it's confusing; because it saids "In the Rails console (rails console), create the new model." and you shouldn't do that in the rails console ("rails c" command) you should execute that comand in the windows console and of course in the root folder of your app. The command it's perfectly fine, Hope this helps

UPDATE:

try doing bundle before the stated command




回答2:


I had the same issue with Rails 4.2.5 and Ruby 2.3. Running bundle update solved the problem for me.



来源:https://stackoverflow.com/questions/13389603/rails-generate-model-returns-nothing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!