rails常见命令



Rake命令

?
1
2
3
4
5
6
7
8
9
10
bundle  exec  rake -T 查看所有的Rake任务
bundle  exec  rake -T db 查看所有db命名空间的任务
bundle  exec  rake db:migrate
bundle  exec  rake db:rollback
bundle  exec  rake db:migrate VERSION=0
bundle  exec  rake db:create:all 根据database.yml文件创建好develop、 test 库,如果已存在,提示已存在
bundle  exec  rake db: test :clone 将develop数据库结构克隆到 test
bundle  exec  rake rspec
bundle  exec  rake assets:precompile RAILS_ENV=production
bundle  exec  rake notes:custom ANNOTATION=TODO

Generate命令

?
1
2
3
4
rails g(enerate) scaffold User name:string email:string --no- test -framework
rails g(enerate) controller StaticPages home help --no- test -framework
rails g(enerate) model Foo bar:string baz:integer
rails generate rspec: install  生成RSpec配置文件(.rspec),用来存放测试文件的文件夹(spec),以及一个存储帮助函数的文件(spec /spec_helper .rb)

Destroy命令

?
1
2
3
rails d(estory) scaffold User
rails d(estory) controller StaticPages home help
rails d(estory) model Foo

New命令

?
1
rails new sample_app --skip- test -unit

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值