-
May 4th, 2012, 10:42 AM
#1
all available methods on a class are not displayed
I am using SpringSource TooSuite 2.9.1 / Eclipse 3.7.2
I'm following Manning's Grails in Action book ...one of the examples deals with
1:m relationships ...in this case one User object has many Posts ( listing 3.11 on pp 83 of book )
...basically, you instantiate a User object , a few Post objects and then add the Post objects
to the User object ...
Whether I run the app from the command line or from within the SpringSource ToolSuite,
the app runs PERFECT, however, when I have the class open in the ToolSuite
development environment, doing a "user. " does NOT list user.addToPosts
as an available method ...it displays user.addToPosts indicating that addToPosts
is not available ...
Once again, the code runs fine but it is very frustrating that the ToolSuite seems to think
addToPosts is illegal ....any ideas ?
My Posts class
package com.grailsinaction
class Post {
String content
Date dateCreated
static belongsTo = [user: User]
static constraints = {
content(blank: false)
}
}
My User class
package com.grailsinaction
class User {
Profile profile
String userId
String password
Date dateCreated
static hasMany = [posts: Post]
static constraints = {
userId(size:3..20, unique:true)
password(size: 6..8, validator: {passwd,user-> return passwd != user.userId})
dateCreated()
profile(nullable: true)
}
static mapping = {
profile lazy: false
}
}
fragment from my Test class
@Test
void testFirstPost() {
def user = new User(userId: 'joe', password: 'secret').save()
def post1 = new Post(content: "First post... woooo")
def post2 = new Post(content: "Second post... woooo")
def post3 = new Post(content: "Third post... woooo")
user.addToPosts(post1)
user.addToPosts(post2)
user.addToPosts(post3)
user.save(flush: true)
assertEquals 3, User.get(user.id).posts.size()
}
-
May 7th, 2012, 01:16 PM
#2
Thanks for posting. This addTo* methods are not yet supported in STS. I raised an issue to track this:
https://issuetracker.springsource.com/browse/STS-2620
-
Jan 28th, 2013, 04:06 PM
#3
This feature is now available in GGTS 3.2.0.M2 (will be available in a day or two).
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules