I followed all of the rules… I did everything they told me to do… It even says that you can do this like normal GORM can…
A real simple structure:
package blah class Author { String name static hasMany = [fiction:Book] static constraints = { } }
package blah class Book { String title static belongsTo = [ author: Author ] static constraints = { } }
And from the example I tried…
import blah.* def fictBook = new Book(title:"IT") def nonFictBook = new Book(title:"On Writing: A Memoir of the Craft") def a = new Author(name:"Stephen King").addToFiction(fictBook).save()
And I’m left with…
No signature of method: mongograilsquickstart.Author.addToFiction() is applicable for argument types: (mongograilsquickstart.Book)
This seems to just not work… Hit me up if you made this work, otherwise I’m gonna push a bug… dan@rhcedan.com
It’s not addToFiction(), but addToFictions() (with an ‘s’)
How do you figure that? The field name on the Author class is “fiction” …