File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
actionview/lib/action_view/renderer Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,22 @@ module ActionView
48
48
#
49
49
# <%= render partial: "account", locals: { user: @buyer } %>
50
50
#
51
+ # == \Rendering variants of a partial
52
+ #
53
+ # The <tt>:variants</tt> option can be used to render a different template variant of a partial. For instance:
54
+ #
55
+ # <%= render partial: "account", variants: :mobile %>
56
+ #
57
+ # This will render <tt>_account.html+mobile.erb</tt>. This option also accepts multiple variants
58
+ # like so:
59
+ #
60
+ # <%= render partial: "account", variants: [:desktop, :mobile] %>
61
+ #
62
+ # This will look for the following templates and render the first one that exists:
63
+ # * <tt>_account.html+desktop.erb</tt>
64
+ # * <tt>_account.html+mobile.erb</tt>
65
+ # * <tt>_account.html.erb</tt>
66
+ #
51
67
# == \Rendering a collection of partials
52
68
#
53
69
# The example of partial use describes a familiar pattern where a template needs to iterate over an array and
You can’t perform that action at this time.
0 commit comments