Rake命令
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命令
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命令
rails d(estory) scaffold User
rails d(estory) controller StaticPages home help
rails d(estory) model Foo
New命令
rails new sample_app --skip-test-unit