(Quick Reference)

respond

Purpose

Attempts to return the most appropriate type for the requested content type (specified by either the Accept header or file extension)

Examples

// pick the best content type to respond with
respond Book.get(1)

// pick the best content type to respond with from the given formats respond Book.get(1), [formats:['xml', 'json']]

Description

The respond method uses Content Negotiation to respond with the most appropriate content type. See the documentation on REST support for more information.

Parameters:

  • object - The object to render
  • arguments - A map of arguments.

Supported arguments:

  • view - The view to use in case of HTML rendering
  • model - The model to use in case of HTML rendering