我有这段代码:
- userlist.each do |member|
= render :partial => 'projects/member_small', :locals => { :user => member }
我想每两次添加一个div元素do | member |发生。所以基本上每两次一次。我想要这个:
- userlist.each do |member|
.row
= render :partial => 'projects/member_small', :locals => { :user => member }
答案 0 :(得分:6)
您可以将列表分成两组:
- userlist.each_slice(2) do |group|
.row
- group.each do |member|
= render :partial => 'projects/member_small', :locals => { :user => member }