Chapter 4. Putting the model to work

 

This chapter covers

  • Generating UIs instantly with scaffolding
  • Customizing scaffolds for your project
  • Using dynamic finders for easy querying
  • Advanced query techniques

We spent a lot of time last chapter on the basics of domain modeling. It wasn’t easy defining all those relationships, but it did lay down the fundamentals you’ll need to build on in each new Grails project. In this chapter, we’ll take our new domain knowledge and build a simple UI for our Hubbub application.

You’ll learn how scaffolds can make bootstrapping a UI lightning fast, and how they can be customized to generate a unique look and feel for your application. Then, once you have some experience building basic scaffolds for domain classes, we’ll teach you some query skills to put that domain model to work. Along the way, we’ll implement a basic search form for Hubbub. With this search form in place, we’ll teach you some powerful grouping query skills and finish up writing a tag cloud.

First things first, though. Let’s explore the amazing productivity gains available through Grails scaffolding.

4.1. Creating instant UIs with scaffolding

In chapter 3, we created a basic User object and explored CRUD operations and querying by hand. But we took you via the scenic route. We could have implemented our feature set in one line of code, without any HTML, by taking advantage of Grails’ scaffolding.

4.2. Groovy querying with dynamic finders and Query by Example

4.3. More sophisticated query options

4.4. Bootstrapping reference data

4.5. Summary and best practices

sitemap