rails-generate

rails-generate

TLDR

List all available generators

>_ rails generate
copy

Generate a new model named Post with attributes title and body

>_ rails generate model [Post] [title:string] [body:text]
copy

Generate a new controller named Posts with actions index, show, new and create

>_ rails generate controller [Posts] [index] [show] [new] [create]
copy

Generate a new migration that adds a category attribute to an existing model called Post

>_ rails generate migration [AddCategoryToPost] [category:string]
copy

Generate a scaffold for a model named Post, predefining the attributes title and body

>_ rails generate scaffold [Post] [title:string] [body:text]
copy

Copied to clipboard
free 100$ digital ocean credit