Skip to content

Instantly share code, notes, and snippets.

@MichaelAstreiko
Created April 8, 2012 19:25
Show Gist options
  • Save MichaelAstreiko/2339446 to your computer and use it in GitHub Desktop.
Save MichaelAstreiko/2339446 to your computer and use it in GitHub Desktop.
Process API call in Controller
def list = {
def domainNameInPluralForm = params.domainInPlural
def domainName = retrieveDomainName(domainNameInPluralForm)
def entity = grailsApplication.getArtefacts("Domain").find {
it.getShortName() == domainName
}?.clazz
def result = entity.list(params)
def converter = [domainNameInPluralForm:result] as JSON
render text: converter.toString(), contentType: 'application/json'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment