Ruby on rails foreach with bootstrap3 row class

后端 未结 1 902
梦如初夏
梦如初夏 2021-02-08 22:30

I would like to foreach loop through data and display this data usings bootstraps grid system having 3 columns per row, however i will need multiple rows for the amount of data

1条回答
  •  无人共我
    2021-02-08 23:09

    use Enumerable#each_slice

    <% @work.each_slice(3) do |works| %>
      
    <% works.each do |work| %>
    *work.name*
    <% end %>
    <% end %>

    0 讨论(0)
提交回复
热议问题