module ImplicitRender

Ruby on Rails 8.0.4

Since v3.0.20

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Action Controller Implicit Render

Handles implicit rendering for a controller action that does not explicitly respond with render, respond_to, redirect, or head.

For API controllers, the implicit response is always 204 No Content.

For all other controllers, we use these heuristics to decide whether to render a template, raise an error for a missing template, or respond with 204 No Content:

First, if we DO find a template, it’s rendered. Template lookup accounts for the action name, locales, format, variant, template handlers, and more (see render for details).

Second, if we DON’T find a template but the controller action does have templates for other formats, variants, etc., then we trust that you meant to provide a template for this response, too, and we raise ActionController::UnknownFormat with an explanation.

Third, if we DON’T find a template AND the request is a page load in a web browser (technically, a non-XHR GET request for an HTML response) where you reasonably expect to have rendered a template, then we raise ActionController::MissingExactTemplate with an explanation.

Finally, if we DON’T find a template AND the request isn’t a browser page load, then we implicitly respond with 204 No Content.

Type at least 2 characters to search.

↑↓ navigate · open · esc close