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
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s