I am creating a Grails project using Groovy/Grails Tool Suite. If I choose Run As >> Groovy Console , I can create sample objects from my domain classes but cannot save them.
So,
new things.Thing(height: 20, length: 30)
creates a new Thing, but
new things.Thing(height: 20, length: 30).save()
throws an exception
No signature of method: thing.Thing.save() is applicable for argument types: () values: []
even though respondsTo states that Things respond to save().
Does anyone know why this is happening?
That's the Groovy console, not the Grails console. They use the same code and look the same, but the Grails version hooks into the application, whereas the Groovy console just has access to the code. To run the console, go to Grails Tools | Open Grails Command Prompt and enter console
in the text field.
This is just a GUI wrapper for running grails console
from the commandline.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.