Ruby on Rails Rails generate commands

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

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

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

Parameters

ParameterDetails
-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.

Remarks

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


Got any Ruby on Rails Question?