Day 0: Cheatsheet

Ruby on Rails banner

The rest of this series can be found here.

After working on this project a few days, I think I need a cheat sheet for my own reference.

New project

$ rails new project-name

Start Rails server

$ bin/rails server

Create new controller

$ bin/rails generate controller controller-name action-name

Find routes

$ bin/rake routes

Create new model

$ bin/rails generate model ModelName field1:fieldtype [field2:fieldtype etc.]

Run a database migration

$ bin/rake db:migrate

Standard order of CRUD actions

  • index
  • show
  • new
  • edit
  • create
  • update
  • destroy