转载请注明出处: http://qiudeqing.com/rails/2016/09/04/rails.html

新建一个controller

rails g controller articles

创建模型

rails generate model Article title:string text:text

运行迁移

rake db:migrate

默认在development区域数据库, 设置其他环境:

rake db:migrate RAILS_ENV = production

rails generate controller卡死

spring运行状态下rails generate会挂起, 解决方法:

spring stop

http://stackoverflow.com/questions/23157426/rails-generate-not-working