Chapter 1. Grails in a hurry . . .
Listing 1.1. Handling redirects
Listing 1.2. Adding a layout
Listing 1.3. A database-driven random
Listing 1.4. Beefing up service
Listing 1.5. Adding real tests
Table 1.1. Crunching numbers: the grails stats command in action
Chapter 2. The Groovy essentials
Listing 2.1. Writing a Groovy script to generate quotes
Listing 2.2. Converting quotes into Pig Latin
Listing 2.3. Your first Spock specification
Listing 2.4. Adding multiple data sets to a test
Listing 2.5. Implementing the quote analyzer
Listing 2.6. Adding a test method for the getQuoteCountPerAuthor() method
Listing 2.7. Implementing getQuotePerAuthor()
Listing 2.8. Creating the quoteStatistics.groovy script
Listing 2.9. Implementing a method at runtime
Chapter 3. Modeling the domain
Listing 3.1. Saving and retrieving a domain object from the database
Listing 3.2. Updating users by changing field values and calling save()
Listing 3.3. Deleting objects from the database is a one-liner
Listing 3.4. Adding constraints in Grails
Listing 3.5. Interrogating the results of a failed validation
Listing 3.6. Recovering from a failed validation
Listing 3.7. Sharing constraints between objects
Listing 3.8. Refactored Profile class with a 1:1 relationship with the User class
Listing 3.9. Adding a 1:1 relationship from User to Profile
Listing 3.10. Post class models all posts for a given User
Listing 3.11. The User.addToPosts() method makes 1:m relationships easy