Skip to content

Instantly share code, notes, and snippets.

@pabloalba
Created October 14, 2013 15:54
Show Gist options
  • Save pabloalba/6977872 to your computer and use it in GitHub Desktop.
Save pabloalba/6977872 to your computer and use it in GitHub Desktop.
Get a list of ids, and show the elements. This code is too damn long for this simple task. Improvements?
def showContents(){
def contents = []
def ids = params.list('id').findAll { it.isLong() }*.toLong()
if (ids) {
contents = Content.createCriteria().list {
'in' 'id', ids
}
}
render view:'showContents', model:[contents:contents]
}
@Alotor
Copy link

Alotor commented Oct 15, 2013

Si no funciona el metodo "getAll" puedes usar "findAllByIdInList" que debería comportarse igual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment