Ruby on Rails Rails generate commands


Usage: rails generate GENERATOR_NAME [args] [options].

Use rails generate to list available generators. Alias: rails g.


-h/--helpGet help on any generator command
-p/--pretendPretend Mode: Run generator but will not create or change any files
field:type'field-name' is the name of the column to be created and 'type' is the data-type of column. The possible values for 'type' in field:type are given in the Remarks section.


The possible values for 'type' in field:type are:

Data TypeDescription
:stringFor smaller pieces of text (usually has a character limit of 255)
:textFor longer pieces of text, like a paragraph
:binaryStoring data including images, audios and videos
:booleanStoring true or false values
:dateOnly the date
:timeOnly the time
:datetimeDate and time
:floatStoring floats without precision
:decimalStoring floats with precision
:integerStoring whole numbers