Reputation: 4728
I am trying to add numbers in the list
<% @name.each do |name| %>
<tr>
<td><%= name.fname %></td>
<td><%= name.lname %></td>
</tr>
<% end %>
I want to make it like 1. John Doe 2. Jane Doe
but not sure which is the standard way to add
<td><li></li></td>,
it is not showing the numbers but only
Upvotes: 0
Views: 176
Reputation: 3766
What you want is an ordered list:
<ol>
<% @name.each do |name| %>
<li>
<%= name.fname %> <%= name.lname %>
</li>
<% end %>
</ol>
Upvotes: 0
Reputation: 3280
Buddy its not
<td><li></li></td>
rather its
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Upvotes: 1
Reputation: 11967
<% @name.each_with_index do |name, index| %>
<tr>
<td><%= index+1 %></td>
<td><%= name.fname %></td>
<td><%= name.lname %></td>
</tr>
<% end %>
Upvotes: 3