title: Ruby on rails foreach with bootstrap3 row class
body: <p>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 as below:</p>
  
  <pre><code>&lt;div class="row"&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;div class="col-md-4"&gt;*DATA HERE*&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Can someone advise how to achieve this using a foreach in rails, obviously the below would only render 1 .row class and place all col-md-4 items returned into it. I would like it to create another .row class after it reaches 3 items per row and start again. I hope that makes sense! What i have so far:</p>
  
  <pre><code>&lt;div class="row"&gt;
  &lt;% @work.each do |w| %&gt;
  &lt;div class="col-md-6"&gt;
  &lt;%= w.image_url %&gt;
  &lt;/div&gt;
  &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>