I have a problem with my each loop. The line that prints programdetail.name and programdetail.bodypart doesn't print the value. Also do you know how can I make this loop a little bit more efficient? I want to print first 2 items with class "odd" and the other 2 with non-class. So and so forth.
<% @counter = 0 %>
<% @program.programdetails.each do |programdetail| %>
<% @counter = @counter + 1 %>
<% @counter = @counter % 3 %>
<% if (@counter == 0)
@counter -= 1
end %>
<%= '<h3 class="odd"><span class="moduleLabel"> #{programdetail.name}</span><span class="moduleDescription">#{programdetail.bodypart}</span></h3>' if @counter != 0 %>
<%= '<h3><span class="moduleLabel">#{programdetail.name}</span><span class="moduleDescription">#{programdetail.bodypart}</span></h3>' if @counter != 0 %>
<% end %>
cyclehelper