Render collection with index

Is there any method for getting the current iteration (for changing row
colors) in the category partial?

<%=render(:partial => “category”, :collection => @categories)%>

thanks,
andy


Andrew S.

Andrew :

Is there any method for getting the current iteration (for changing row
colors) in the category partial?

<%=render(:partial => “category”, :collection => @categories)%>

Use the variable category_counter in your partial.

– Jean-François.


Ruby ( http://www.rubyfrance.org ) on Rails ( http://www.railsfrance.org
)

Use the variable category_counter in your partial.

– Jean-François.

Thanks so much! I knew there had to be something there…just couldn’t
find
it.


Andrew S.

On 2/17/07, Aaron [email protected] wrote:

Aaron

That is cool. I wish I new that before I wrote my row_class method. :slight_smile:


Andrew S.

Andy,

The cycle method is a great way to do this. Here is an example:

Then just style ListLine0 and ListLine1.

Aaron

That is cool. I wish I new that before I wrote my row_class method. :slight_smile:

Also wish I could spell… :wink:

sorry for the extra noise.


Andrew S.