Skip to content

Configuration

addFormat()

addFormat() — returns void

Available in: controller, model, mapper, migrator, migration, tabledefinition Category: Miscellaneous Functions

Adds a new MIME type to your Wheels application for use with responding to multiple formats.

NameTypeRequiredDefaultDescription
extensionstringyes—File extension to add.
mimeTypestringyes—Matching MIME type to associate with the file extension.
// 1. Add the `js` format
addFormat(extension="js", mimeType="text/javascript");

// 2. Add the `ppt` and `pptx` formats
addFormat(extension="ppt", mimeType="application/vnd.ms-powerpoint");
addFormat(extension="pptx", mimeType="application/vnd.ms-powerpoint");

// 3. Add a custom `csv` format so controllers can respond with `responds(formats="csv")`
addFormat(extension="csv", mimeType="text/csv");