Skip to content

Commit 8505a60

Browse files
Document options for render in API [ci skip]
Creates parity with the [guides][g] by documenting the [variants][v] option. [g]: https://guides.rubyonrails.org/v8.0/layouts_and_rendering.html#options-for-render [v]: https://guides.rubyonrails.org/v8.0/layouts_and_rendering.html#the-variants-option
1 parent f511cd3 commit 8505a60

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

actionpack/lib/action_controller/metal/rendering.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ def inherited(klass)
160160
# render "posts/new", status: :unprocessable_entity
161161
# # => renders app/views/posts/new.html.erb with HTTP status code 422
162162
#
163+
# `:variants`
164+
# : This tells Rails to look for the first template matching any of the variations.
165+
#
166+
# render "posts/index", variants: [:mobile]
167+
# # => renders app/views/posts/index.html+mobile.erb
168+
#
163169
#--
164170
# Check for double render errors and set the content_type after rendering.
165171
def render(*args)

0 commit comments

Comments
 (0)