[Ruby] Ruby on Rails model creation/deletion command

less than 1 minute read

Model making

The model creation command is rails g model Model name (singular, initial capital letters) Column name 1: Data type Column name 2: Data type …

Example: rails g model User name:string email:string

Apply migration file after command execution rails db:migrate

Delete model

The command to delete the model is rails destroy model model name

Example: rails destroy model User

** * It is not possible to omit destroy and write d **