Creating a New Controller

Now that we’re all warmed up and ready, we’ll get to work on the new organizer’s dashboard view. To keep our overall architecture clean and not confuse the conventions that have proved so helpful to us, we will create a new controller for the dashboard view and any related views. We’ll use the create-controller script to do this:

 
$ ​grails create-controller com.tekdays.Dashboard

The script creates the file TekDays/grails-app/controllers/com/tekdays/DashboardController.groovy, along with the corresponding test file TekDays/test/unit/com/tekdays/DashboardControllerSpec.groovy. It also creates the TekDays/grails-app/views/dashboard directory, where our new controller will look for views.

Get Grails 2: A Quick-Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.