I am currently working on a Grails project and would like to know the best way of showing a select list of objects from the Spring Security domain model:
I know how to create a select list but I just want to find out the best way within grails to populate it with the objects from that domain. I was thinking of calling something like "user.list(params)" and then passing that to the view, I could then access the defined object within that domain, but im not 100% sure wether that is the best way or if it can be done that way?
Thanks in advance
EDIT.....
I have the following custom model setup in the controller:
class UserModel {
String username
String firstName
String lastName
def email = User.email.list()
String[] emails = email
static constraints = {
username blank: false
firstName blank: false
lastName blank: false
}
}
Then when the index page for this view is initialized I pass this to it:
[model: new UserModel(copy)]
and finally on the view i have this:
<g:select name="emails" from="${model.emails}"
Now when I run the application I get this error:
No signature of method: grails.plugins.springsecurity.ui.UserModel.propertyMissing() is applicable for argument types: () values: [] Possible solutions: propertyMissing(java.lang.String)
Can anyone please help with this?? Thanks