I have 3 entries in my database, and I want them to look like this: if I use for (each)
<% @records.each do |record| %>
You probably want each_with_index . something like:
each_with_index
<% @records.each_with_index do |record, i| %> <%= (i+1) %>. <%= record.foo %> <br /> <% end %>
you can use each_with_index:
<% @records.each_with_index do |record, i| %> #your code <% end %>
Just wrap it in ol, so the numbering will be dynamic:
<ol> <% @records.each do |record| %> <li><%= record %></li> <% end %> </ol>
Take a look at each_with_index:
<% @records.each_with_index do |record, index| %>