Reputation: 10613
I'm using the grails console to play with my relationships. I'm using the excersises on the book Grails in Action
:
I have the relationship:
class User {
...
Profile profile
static hasMany = [posts: Post, tags: Tag, following: User]
...
User.get(3).addToFollowing( User.get(2) ).save()
User.list().each { print it.following }
yields
null null [com.grailsinaction.User : 2] null null
and again running:
User.get(1).addToFollowing( User.get(2) ).save()
User.list().each { print it.following }
gives
[com.grailsinaction.User : 2] null null null null
Looks like the first addToFollowing
is lost... did I forget anything?
Upvotes: 0
Views: 87