我希望将所有传递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 %>
答案 0 :(得分:2)
尝试以下
<%= 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 %>