LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

rails-destroy

Remove files created by Rails generators

TLDR

Remove model
$ rails destroy model [Name]
copy
Remove controller
$ rails destroy controller [Name]
copy
Remove scaffold
$ rails destroy scaffold [Name]
copy
Remove migration
$ rails destroy migration [Name]
copy

SYNOPSIS

rails destroy generator name [options]

DESCRIPTION

rails destroy is the inverse of rails generate, removing all files and modifications that a generator previously created. It deletes model files, controllers, views, migrations, test files, and route entries that were scaffolded, cleanly undoing the generator's work without leaving orphaned code.
The --pretend flag previews which files would be removed without actually deleting anything, allowing verification before committing to the operation. The command accepts the same generator names and arguments as rails generate, making it straightforward to reverse any previous scaffolding operation.

PARAMETERS

model name

Remove model.
controller name
Remove controller.
scaffold name
Remove scaffold.
migration name
Remove migration.
-p, --pretend
Preview without removing.

SEE ALSO

Copied to clipboard
Kai