why zkui generators still use closures in grails controller rather than methods?

11 views
Skip to first unread message

mauro

unread,
Nov 6, 2013, 4:36:48 AM11/6/13
to zk-ui...@googlegroups.com
I've created a grails application for test.
Create a domain class the run zkui-generate-all.
In the grail controller I have:

def index = {
        redirect(action: "list", params: params)
    }

    def list = {}

    def create=  {
        def bookInstance = new Book()
        bookInstance.properties = params
        return [bookInstance: bookInstance]
    }

    def edit = {
        def bookInstance = Book.get(params.id)
        if (!bookInstance) {
            flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'book.label', default: 'Book'), params.id])}"
            redirect(action: "list")
        }
        else {
            return [bookInstance: bookInstance]
        }
    }

Why still using closures rather than methods?
I've modified, for example the create closure to:

def create() {
        respond new Book(params)
    }

using the new respond method and it works.
Reply all
Reply to author
Forward
0 new messages