From: Matthew Moss Date: 2008-03-01T00:51:14+09:00 Subject: Re: possible to optimize this? On Feb 29, 10:45 am, laredotornado wrote: > Hi, > > I am creating a variable "counter" to count the number of iterations. > But I get the funny feeling Ruby (I'm using 1.8) may already have some > kind of implicit counter in the loop. Does anyone know of a way the > below can be optimized? each_with_index, part of the Enumerable module. <% @ec_orders.each_with_index do |ec_order, index| %> > <%=h ec_order.ship_first_name %> <%=h ec_order.ship_last_name %> <%=h ec_order.invoice_num %> <%= link_to 'View', {:action => 'view', :id => ec_order.id} %> <% end %>