Constraints and Static Scaffolding

In this Grails Example, we add validation constraints to our model. This limits the data that an end-user can enter into our scaffolded views. Constraints in your model definition are automatically rendered in your scaffolded views. There are many types of constraints such as making a field required, unique, or one that only accepts a range of values.

Once we have our constraints in place, we will generate Static Scaffolding, which allows us to see the actual code behind the controllers and views that scaffolding uses. Using Static Scaffolding allows you to customize these files.

Video #15 shows how to enable data entry constraints and Static Scaffolding.

Instant UI – Dynamic Scaffolding

In this Grails Example, we will invoke a powerful feature of Grails called Dynamic Scaffolding. With a simple one-line command in our controllers, Grails will dynamically build an HTML 5 user interface that contains create, read, update, and delete (CRUD) functionality. The UI also recognizes the relationships between our models and adds the necessary links to connect parent and child data objects together, such as task to projects, projects to owners, etc.

Video #14 shows how to enable Dynamic Scaffolding on your models.

Designing the Data Model

In this Grails Example, we will design and build the remaining models for the ProjectTracker Application. We will first design the data model on paper by defining the individual entities, which will become models. We will then describe the attributes of each entity, which become the fields in our views. Finally we will include the relationships between entities by creating one-to-many joins between the entities. Once we have the design sketched out, we will go into Eclipse and create the models, fields, and joins.

Video #13 shows how to build the remaining models in Eclipse