Command Line: Destroy
Hanami has convenient code generators to speed up our development process.
If we commit a mistake, we can destroy what we just generated via
hanami destroy command.
With the Container architecture, we can have multiple Hanami applications running under
We can generate new applications for different components that we want to add to our project.
To destroy one of them:
$ bundle exec hanami destroy app admin
This removes an application named
We can destroy an action along with the corresponding view, template, route and test code with one command.
$ bundle exec hanami destroy action web books#show
The first argument,
web, is the name of the target application in a Container architecture.
It must be omitted if used within an Application architecture:
$ bundle exec hanami destroy action books#show
books#show is the name of the controller and the action separated by the number sign (
We can destroy a model.
$ bundle exec hanami destroy model book
It removes an entity with the corresponding repository and test code.
We can destroy a migration.
$ bundle exec hanami destroy migration create_books
It deletes the migration with the corresponding name (eg.
We can destroy a mailer.
$ bundle exec hanami destroy mailer welcome
It removes the mailer, and the associated templates.