Is there an implicit index in this loop?

Hi,

I have the partial below …

            <% fields_for "ec_order[ec_line_item_attributes][]",

ec_line_item do |ec_line_item_form| %>

Item ####
<% end %>

What I’m wondering is if there’s a way I can substitute the “###” with
an expression that would list the index of the loop (e.g. “1” would be
the result for the first iteration, “2” for the second, and so on).

Sure there’s an easy way, just don’t know it.

Thanks, - Dave

On 14 Feb 2008, at 02:04, [email protected] wrote:

<% end %>

What I’m wondering is if there’s a way I can substitute the “###” with
an expression that would list the index of the loop (e.g. “1” would be
the result for the first iteration, “2” for the second, and so on).

Sure there’s an easy way, just don’t know it.

if you’re rendering a partial foo, then in addition to there being a
local variable called foo, there’s also one called foo_counter

Fred