Show Menu

Rails4 Model&Migration Generator (WorkInProgress) Cheat Sheet by

A cheatsheet for rails 4 model and migration generator
rails     migration     model     generator     rails4

Migration Scheme Methods

rename­_column <ta­ble­>, <ol­d_c­olu­mn>, <ne­w_c­olu­mn>

Basic Migration Generation

Migr­ation Type
Comm­and
prepended by 'rails generate migration '
Add XXX To Table YYY
AddXXX­ToYYY [CCC CCC ...]
Remove XXX From Table YYY
Remove­XXX­ToYYY [CCC CCC ...]
Create Table YYY
CreateYYY [CCC CCC ...]
Add References to Table YYY
AddOOO­Ref­ToYYY
Create Join Tables
Create­Joi­nTa­ble­YYYZZZ
XXX - Migration Name
YYY - Table Name
ZZZ - Second Table Name
OOO - object reference
CCC - Column Combos. Refer to column tables for possib­lities

Basic Model Generation

Model Type
Comm­and
prepended by 'rails generate model '
Basic Model
XXX [CCC CCC ...]
 

Column Combos

Basic Column
NNN:TTT
Indexed Column
NNN:TT­T:index
NNN - Column Name
TTT - Column Type. Refer to Types for possib­ilities

Types

:binary
:boolean
:date
:datetime
:decimal
:float
:integer
:prima­ry_key
:refer­ences
:string
:text
:time
:timestamp
------ PostgreSQL Specific Types -------
:hstore
:json
:array
:cidr_­address
:ip_ad­dress
:mac_a­ddress

Download the Rails4 Model&Migration Generator (WorkInProgress) Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/wayland-he_rails4-model-migration-generator-workinprogress.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Rails 4 Cheat Sheet
            Ruby on Rails Cheat Sheet by Dave Child and addedbytes.com
          Conceptual Database Design Cheat Sheet

          More Cheat Sheets by Wayland He