Grails (2.3.x): Scaffolding – 2.0.x not showing list


I have a domain (Task) and a controller (TaskController) in my Grails 2.3.7 project.

Task.groovy


class Task {

    String name
    String description

    static constraints = {

        name()
        description()
    }

    String toString() {
        "${name}"
    }
}

TaskController.groovy


class TaskController {

    def scaffold = true

    def index() {
        
    }
}

After adding a task from the generated UI of Scaffold, if I navigate to Task List (i.e. http://ROOT_PATH/task/index), there is no list displaying. Though it should display a list of Tasks that I had added.

Some Grails version may also produce the following error:

ERROR view.ScaffoldingViewResolver – Error generating scaffolded view

Workaround

Scaffold renamed their “list” method to “index” and which conflicts with the default method “index” of any Grails controller. so one simple workaround would be to remove

def index() {}

method from Grails controller.

TaskController.groovy


class TaskController {

    def scaffold = true
}

Advertisements