-
Notifications
You must be signed in to change notification settings - Fork 43
Using respond with a custom model name #66
Copy link
Copy link
Closed
Milestone
Description
It appears that if I use respond then the model name is determined by the type e.g.
class HelloController {
static responseFormats = ['json']
def test() {
def messages = [
[hello: 'world'],
[foo: 'bar']
]
respond messages
}
}My view has to look like this:
model {
List linkedHashMapList
}
json {
messages linkedHashMapList
}If I don't use respond, and simply return a Map from my action, then I can use whatever model name I want in my view:
class HelloController {
static responseFormats = ['json']
def test() {
def messages = [
[hello: 'world'],
[foo: 'bar']
]
[messages: messages]
}
}model {
List messages
}
json {
messages messages
}Is there a way to use respond and use a custom name for the model? It appears that passing a model argument to respond does not work, it still uses the name determined by type.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels