i have 2 domain classes as shown below
class User
{
String userId
String userName
SsGroups groups
**static hasMany = [groups:SsGroups]
static belongsTo=SsGroups**
}
class SsGroups
{
String groupId
**static hasMany = [users:User]**
}
i implemented many to many relation,its working well and fine.now i wanna select multiple groups from SsGroups to a single User,here is the code in User,create.gsp.
<g:select name="groups.id" multiple="yes" from="${app.SsGroups.list()}" optionKey="id" value="${userInstance?.groups?.id}" />
but while saving there is an error saying Error 500: Executing action [save] of controller [app.UserController] caused exception: groovy.lang.MissingMethodException: No signature of method: app.SsGroups.get() is applicable for argument types: (java.lang.String, java.lang.String) values: [2, 3] Possible solutions: get(java.lang.Object), getId(), getAt(java.lang.String), list(), getAll(), getLog(). please can you guide me how to select multiple values and store those??
This controller User:
def save = {
def userInstance = new User(params)
if (userInstance.save(flush: true)) {
flash.message = "${message(code: 'default.created.message', args: [message(code: 'user.label', default: 'User'), userInstance.id])}"
redirect(action: "show", id: userInstance.id)
}
there is no get() method in it.Where do i need to write getAll() method?