创建/撤销 model | # 创建
rails g model Admin name:string email:string password_digest:string role:references
# 删除
rails destory model Admin
|
数据库 db 迁移/回滚 | rails db:migrate
rails db:rollback
|
创建 controller | # 会自动生成 n 个方法
rails generate controller Users
# 指定生成 n 个方法
rails g controller Sessions new create destroy
|
创建 resource | rails g resource User name:string --controller
|
创建 jbuilder | rails g jbuilder post
|
创建 job | rails generate job IncrementViews
|
创建 migration | rails g migration AddViewsCountToPosts views_count:integer
|