Grails in Action, 2nd Edition Errata
Thank you for purchasing Grails in Action, 2nd Edition. Please post any errors, other than those listed below, in the book's Author Online Forum or on GitHub. We'll compile a comprehensive list and publish it here for everyone's convenience. Thank you!
Last updated March 31, 2015
The following list contains errors in the book. Readers are also running into issues when using Grails 2.4 and later. Newer versions of AngularJS may be problematic too. Be sure to check the forum and GitHub issues when using different versions to those specified in the book.
- The QOTD sample application from chapter 1 requires Grails 2.3.9 at least if you want to run it using Java 8. Otherwise you will see a compilation error (shown in full on GitHub).
- Section 1.3.3 (in chapter 1) makes a reference to a
tag. It should be (different prefix). The code listing uses the correct r: prefix.
- In chapter 3, the custom validator constraint on the password property means that it can't be imported into ApplicationUser (listing 3.7). The custom validator expects a loginId property that doesn't exist. Removing the custom validator allows you to save new ApplicationUser instances.
- Chapter 3 has an entity relationship diagram that the sharp-eyed may notice is not entirely correct. It shows User having a 1:m relationship with itself (a user may follow many users). In fact, it's conceptually a m:n relationship as a user can be followed by many users too. The implementation is effectively a unidirectional 1:m mapping though.
- Section 3.2 states that the create-domain-class command generates a unit test in the file UserTests.groovy. In fact, Grails 2.3 started using Spock by default, so the generated file is UserSpec.groovy.
- Section 3.2.1 has a line "Recall from chapter 1 that you create integration tests with this command". This is incorrect as chapter 1 doesn't introduce integration tests. So section 3.2.1 is the first appearance of the create-integration-test command.
- The first sidebar in section 3.2.1 says that you will dive into Groovy mixins in chapter 7. That should be chapter 9, the one on testing.
- Section 3.4.2 has a sub-section titled "Keeping the many side sorted" (page 85). The second paragraph of that sub-section says that listing 3.10 uses the mapping property in the Profile class. That reference is completely erroneous and should be ignored.
- In figure 3.10, the public.user entity has a user_id property. That should be login_id.
- Chapter 4 refers to a list.gsp file. That only exists in Grails 2.2 and earlier. For Grails 2.3 and later, the relevant file is index.gsp.
- The scaffolding in chapter 4 doesn't work when creating or modifying a user profile with an image. This is a bug in Grails that has yet to be fixed. The issue in GitHub discusses suitable workarounds.
- Listing 5.3 uses params.loginId in the model returned by the action. Although this works, the action has an explicit loginId argument that should be used instead. In other words, the params. prefix shouldn't be there.
- Chapter 8 refers to a section in chapter 2 on Groovy's MarkupBuilder class. That section doesn't exist - the reference is a hangover from the first edition.
- Chapter 8 includes two code fragments, just after code listing 8.13, that have an incorrect jQuery selector: $('tinyUrl'). It should be $('#tinyUrl'), i.e. with a hash symbol.
- Listing 10.4 declares an action with an email argument. The action method then references params.email. Although this works, the method should just reference the email argument directly, i.e. remove the params. prefix.
- Listings 13.10 and 13.11 have isEditState = false lines in them. These are redundant and should be ignored.