Way to alternate styles/classes?

Hi,

I’m trying to alternate between two classes to apply to a partial.

                                            <div

id=“ec_line_items”>
<%=
render :partial => ‘summary_line_item’, :collection =>
@ec_order.ec_line_items %>

Is it possible to apply a different background color depending on
whether the row is even or odd? The content of the partial is
below …

Prescription #<%= summary_line_item_counter+1 %>
<%= image_tag '/images/RxICON_Cream.gif', options = {:alt => ""} %> Refill Number Drug Name Day Supply
#<%= summary_line_item.prescription_number %> <%= summary_line_item.description %> <%= summary_line_item.day_supply %>

Thanks, - Dave

[email protected] wrote:

Hi,

I’m trying to alternate between two classes to apply to a partial.

I believe there is a helper designed for this very thing called,
“cycle.” It will cycle through an array of arguments given each time it
is called.

So:

It also has some advanced featured, details in the API here:
http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001738