kar
kar

Reputation: 3651

Unable to setup scaffold due to missing method

I am trying to setup scaffold to get a visual rep for my database testing. I am able to see the controller option on the webpage but upon clicking it, I get the following error.

groovy.lang.MissingMethodException

No signature of method: static grails.artefact.DomainClass.count() is applicable for argument types: () values: [] Possible solutions: print(java.io.PrintWriter), print(java.lang.Object), wait(), any(), dump(), collect()

Not able to understand what is going on. Trying to look at docs and nothing seems to point to this. I am just having a Class and setting up a controller for that class as follows. Unsure what I am doing wrong. Doubt its relevant but the class names for Award and OnlineOrder are correct.

Controller

package rewards

import grails.artefact.DomainClass

class CustomerController {

    static scaffold = DomainClass

    //def index() {}
}

Class

package rewards

class Customer {

    String firstName
    String lastName
    long phone
    String email
    int totalPoints

    static hasMany = [awards:Award, orders:OnlineOrder]

    static constraints = {

    }
}

Upvotes: 1

Views: 138

Answers (1)

Jeff Scott Brown
Jeff Scott Brown

Reputation: 27255

package rewards

import grails.artefact.DomainClass

class CustomerController {

    static scaffold = DomainClass

}

grails.artefact.DomainClass is a trait. You can't scaffold a trait. The value that you assign to the scaffold property needs to be your domain class. For example...

package rewards

class CustomerController {

    static scaffold = Person

}

Upvotes: 2

Related Questions