I have the following loop
I am trying to identify every 3rd item in loop so that I can create a layout row (to prevent different heights of divs causing weird flow in the page). I am using dato middleman gem but i think that is irrelevant as this is purely ruby syntax issue??
<% dato.home.types_of_paddling.each do |typesofpaddling, i| %>
<% puts '<div class="row">' if (i % 3 == 0) %>
Block Content Here
<% puts '</div>' if (i % 3 == 2) %>
<% end %>
I get an error as follows undefined method `%’ for nil:NilClass