i am in the middle of some customizations for a blog i want to put up. I simply want to list the first 4 Articles per Tag and do some templating stuff but even with good java knowledge, i cant get the ERB stuff to go. Here is what i have:
<% blog.tags.each do |tag, articles| %>
<div id="<%= tag %>" class="tabcontent active">
<% articles[0...4].each do |article| %>
<div class="col-lg-3 col-md-6 col-sm-12 col-xs-12">
<% end %>
<% end %>
This works ok. Now the thing… i want to have the active class only for the first item in the loop. This is such a basic question, i hardly can type it I tried the following:
blog.tags.each_with_index do |tag, articles, index| --> doesnt work
I tried only iterating on tags.each_with_index and do an inner loop with tag.articles ----> doesnt work
I tried a manual counter —> seems manually increasing vars in ERB is not possible ?!?
Most likely this is an noob ruby question but even with some time spent on google, i couldnt figure it out. Thanks for help.