Back
provides()
1. Provide HTML, XML, and JSON responses
function config() {
provides("html,xml,json");
}
2. Provide only JSON and CSV
function config() {
provides("json,csv");
}
3. Default behavior (HTML only)
function config() {
provides(); // equivalent to provides("html")
}
4. Handling requested format in the action
function show() {
// Wheels automatically detects the requested format and renders accordingly
renderwith(data=model("user").findByKey(params.id));
}
Copied!