(Quick Reference)

create-scaffold-controller

Purpose

The create-scaffold-controller command creates a controller that scaffolds the given domain class, based on convention.

Examples

grails create-scaffold-controller
grails create-scaffold-controller org.bookstore.Book

Description

Creates a dynamic scaffolding controller for the given domain class. If the domain class does not exist, the command will fail. The argument is optional, but if you don't include it the command will ask you for the name of the domain class to scaffold.

A controller is responsible for handling incoming web requests and performing actions such as redirects, rendering views and so on. A dynamically scaffolding controller automatically provides a fully-fledged CRUD user interface for a particular domain class, allowing users to create new records, modify them, and delete them.

With the second example above, this command will create the file grails-app/controllers/org/bookstore/BookController.groovy that declares a controller class containing a static scaffold property. The controller's package is the same as for the domain class and the class name is the domain class name with a 'Controller' suffix.

Note that this command is just for convenience and you can also create dynamic scaffolding controllers in your favourite text editor or IDE if you choose.

Usage:

grails create-scaffold-controller [name]

Fired Events:

  • CreatedFile - When the controller is created