From 3ea926b86a209d67c210fc105cadcad73984e3e0 Mon Sep 17 00:00:00 2001 From: kenta-s Date: Mon, 6 Feb 2017 21:47:07 +0900 Subject: Add information on `:formats` option in action_view_overview.md --- guides/source/layouts_and_rendering.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'guides') diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 293c99fc8f..5a3fadde40 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -411,6 +411,8 @@ render formats: :xml render formats: [:json, :xml] ``` +If a file with the specified extension does not exist, a `MissingTemplate` error will be raised. + #### Finding Layouts To find the current layout, Rails first looks for a file in `app/views/layouts` with the same base name as the controller. For example, rendering actions from the `PhotosController` class will use `app/views/layouts/photos.html.erb` (or `app/views/layouts/photos.builder`). If there is no such controller-specific layout, Rails will use `app/views/layouts/application.html.erb` or `app/views/layouts/application.builder`. If there is no `.erb` layout, Rails will use a `.builder` layout if one exists. Rails also provides several ways to more precisely assign specific layouts to individual controllers and actions. -- cgit v1.2.3