tags:

views:

135

answers:

1

I just started with grails in action book.

made the new app by grails create-app

then the book says to have the following code in the QuoteController.groovy

class QuoteController {
    def index = {}
    def home = {
        render= "<h1>Real programmers do not each Quiche</h1>"
    }
}

Now when I browse to page http://localhost:8080/qotd/quote/home I get the following error:

Error 500: groovy.lang.MissingPropertyException: No such property: render for class: QuoteController
Servlet: grails
URI: /qotd/grails/quote/home.dispatch
Exception Message: No such property: render for class: QuoteController
Caused by: groovy.lang.MissingPropertyException: No such property: render for class: QuoteController
Class: Unknown
At Line: [-1]
Code Snippet:

seems like 'render' is not a valid property? Any ideas what I could be doing wrong? I am using Grails 1.1.1

+3  A: 

....must be time for me to call it a night..book says to code the following:

class QuoteController {
    def index = {}
    def home = {
        render "<h1>Real programmers do not each Quiche</h1>"
    }
}

instead of render = "..."

hehe, classic mistake for beginner programmers =)given groovy's dynamic nature, you need to watch out for typos all the time.
Chii
You'll get the feel soon though. Good work!
Colin Harrington
Small hint here, just so you know what's actually going on: render is a method with one string parameter (there are other overloads though). In Groovy you can omit the parentheses for methods with a single parameter.
Daniel Rinser