Thursday, 30 September 2010

Grails & 'Grails in Action' - some notes & comments

I have just started playing with grails.
I am using 'Grails in Action' as my reference.
My current version of grails is 1.3.4
I am using the STS eclipse IDE with their built in grails plugin

Here are some initial notes on GOTCHAs I have found with the book and grails itself.
NB I will continue to update this one page with other gotchas, instaed of creating many pages.

Comments on 'Grails in Action'

1) p28, list 1.22
'render' should be 'response.outputStream <<'

2) logo.png & snazzy.css are needed for chapt 1 & can be got from github

Comments on Grails 1.3.4

1) can not create integration tests - getting error
Error executing script CreateIntegrationTest: No such property: type for class: CreateIntegrationTest
No such property: type for class: CreateIntegrationTest

edit the file scripts/CreateIntegrationTest.groovy in your grails installation
and add the line
def type = "Tests"
after the line
depends(checkVersion, parseArguments)

NB this is fixed in 1.3.5

2) when running the test via 'grails test-app' the url for the report is incorrect
and is missing the trailing 's' from the URL

edit the file scripts/_GrailsTest.groovy line 402 and add a space after the the closing brace of testReportsDir and before the double quote
msg += " - view reports in ${testReportsDir} "

3) 1.3.5 bug - add a contraint that specifies the size of the field then it does not check for null.
IE This will allow a nulll value in name:
static constraints = {
name (size:3..8)

The work around is to do this:

static constraints = {
name (size:3..8, blank:false)

bug GRAILS-6821 has been raised on version 1.3.5


DaveD said...

Apart from the slightly shaky quality of it's publications how are you finding Grails so far?

Bill Comer said...

only on chapt 3 but impressed with the 'Convention over Configuration'

Anonymous said...

render is correct , certainly for the version the is written at (1.1) .. Can't comment on 1.3 + ..

Bill Comer said...

perhaps it is just be Anon then, but I certainly needed to make that change. I needed to do a similar thing for p147