I'm working through the "Grails in Action" book, and I'm stuck at that part that introduces the grails console. From my project directory, I typed "grails console" to open a console window, and the console even output information indicating it was compiling classes, but when I type this into the console:
new Quote(author:'Larry Wall',content:'There is more than one method to our madness.').save()
I get this error:
unable to resolve class Quote
at line: 1, column: 1
The Quote class exists in Quote.groovy in grails-app/domain/qotd/Quote.groovy
, and I'm not able to run the above command.
What's going wrong here?
Did you try importing the package that contains your domain class before trying to instantiate it?
import qotd.Quote
new Quote(author:'Larry Wall',content:'There is more than one method to our madness.').save()
to be sure you can also try specifying the full qualified name:
new qotd.Quote(author:'Larry Wall',content:'There is more than one method to our madness.').save()
I'm going through the MEAP of Grails in Action second edition (2.1.1) and found that the solution is run:
grails clean
grails console
type the code in the groovy console again and run
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With