I am rendering a rails partial and I want to alternate the background color when it renders the partial. I know that is not super clear so here is an example of what I want to do:
Row One grey Background Row Two yellow background Row Three grey Background Row Four yellow background- sorry stackoverflow seams to prevent the background colors from being shown but I think this makes my idea clear
This is the view code that I am using
<table>
<%= render :partial => 'row' :collection => @rows %>
</table>
the _row.html.erb partial looks like this
<tr bgcolor="#AAAAAA">
<td><%= row.name %></td>
</tr>
The problem is I do not know how to change the background color for every other row. Is there away to do this?