It would be a lot better just to just records.size, because the info's already there.
Anyway, you can do <% counter = 1 %> <% records.each do |r| %> <% counter += 1 %> .. other stuff <% end %>
Pat
It would be a lot better just to just records.size, because the info's already there.
Anyway, you can do <% counter = 1 %> <% records.each do |r| %> <% counter += 1 %> .. other stuff <% end %>
Pat
Your best way is to use each_with_index, for example
<% @users.each_with_index do |user, index| %>
User #<%= index+1 %>. <%= user.username %>
<% end %>
That seems to work well for me