Rendering extension adds
display helper methods to controllers that reduce common boilerplate when producing rendered representations of media types and setting response “Content-Type” headers.
Controller#render(object, include_nil: false) loads
object into the
the current applicable
MediaType (as from
renders it using the fields provided by
Controller#expanded_fields (from the
Controller#display(object, include_nil: false) calls
render (above) with
object, assigns the result to the current
response.body, sets the
response’s “Content-Type” header to the appropriate MediaType identifier,
and returns the response.
To use this extension, include it in a controller with