rails-generate
Scaffold Rails application components from templates
TLDR
Generate model
SYNOPSIS
rails generate generator name [options]
DESCRIPTION
rails generate creates boilerplate files from templates for common Rails application components. It scaffolds models with database migrations, controllers with associated views and routes, and full CRUD interfaces through the scaffold generator, following Rails naming conventions and directory structure automatically.
Each generator produces the appropriate set of files including source code, test stubs, and configuration entries. The --pretend flag previews what would be created without writing files, and --skip-routes prevents automatic route additions. Custom generators can be created to match project-specific patterns, and the inverse operation rails destroy removes all files a generator created.
PARAMETERS
model name
Generate model.controller name
Generate controller.scaffold name
Generate full CRUD.migration name
Generate migration.-p, --pretend
Preview without creating.--skip-routes
Don't add routes.
SEE ALSO
rails(1), rails-destroy(1)
