将本地人从局部视图传递到另一个局部视图
Passing locals from partial view to another partial view
我想将所有通过的 locals
从一个局部视图传递到 0-N 个内部局部视图。
示例:
# my_view.html.erb
<%= render partial: 'my_partial_view', locals: { ...dynamic amount of variables... } %>
...
# _my_partial_view.html.erb
<%= render partial: 'inner_partial_view_A', locals: ??? if ABC %>
<%= render partial: 'inner_partial_view_B', locals: ??? if DEF %>
<%= render partial: 'inner_partial_view_C', locals: ??? if XYZ %>
尝试关注
<%= render partial: 'inner_partial_view_A', local_assigns if ABC %>
<%= render partial: 'inner_partial_view_B', local_assigns if DEF %>
<%= render partial: 'inner_partial_view_C', local_assigns if XYZ %>
我想将所有通过的 locals
从一个局部视图传递到 0-N 个内部局部视图。
示例:
# my_view.html.erb
<%= render partial: 'my_partial_view', locals: { ...dynamic amount of variables... } %>
...
# _my_partial_view.html.erb
<%= render partial: 'inner_partial_view_A', locals: ??? if ABC %>
<%= render partial: 'inner_partial_view_B', locals: ??? if DEF %>
<%= render partial: 'inner_partial_view_C', locals: ??? if XYZ %>
尝试关注
<%= render partial: 'inner_partial_view_A', local_assigns if ABC %>
<%= render partial: 'inner_partial_view_B', local_assigns if DEF %>
<%= render partial: 'inner_partial_view_C', local_assigns if XYZ %>