I have one gsp file which calls a method like this:
<g:link id="${child.id}" action="callChildProfile" controller="profile">${child.firstname}</g:link>
which calls this method
def callChildProfile(Long id){
childInstance = Child.get(id)
System.out.println(childInstance.firstname + " child instance")
redirect(action: "index")
}
this method set a child instance to a public variable called child instance but when the redirect happens the variable is reset. The reason I redirect is because I want to load up the index page from this controller.
Index looks like this:
def index() {
def messages = currentUserTimeline()
[profileMessages: messages]
System.out.println(childInstance + " child here")
[childInstance : childInstance]
}