Rails view to list users in a zebra-striped table &lt;% i = 0 %&gt; 
&lt;% @patients.each do |patient| %&gt; 
 &lt;tr class="&lt;%= i % 2 == 0 ? 'Even' : 'Odd' %&gt;"&gt;
    &lt;td&gt;&lt;%= link_to patient.id, patient %&gt;&lt;/td&gt;
    &lt;td&gt;&lt;%= patient.user.username %&gt;&lt;/td&gt;
    &lt;td&gt;&lt;%= patient.user.first_name %&gt;&lt;/td&gt;
    &lt;td&gt;&lt;%= patient.user.last_name %&gt;&lt;/td&gt;
    &lt;td&gt;&lt;%= patient.user.email %&gt;&lt;/td&gt;
    &lt;td&gt;&lt;%= patient.user.active %&gt;&lt;/td&gt;
    &lt;td&gt;&lt;%= patient.user.disabled %&gt;&lt;/td&gt;
    &lt;td&gt;
      &lt;ul class="Horizlist"&gt;
        &lt;li&gt;&lt;%= link_to 'Detail', patient %&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;% i += 1 %&gt;    


I don't like that I have to define an i variable, is there a better way?
Rails has a built in method, cycle, which will cycle between two more more options for you, so you don't have to manage the "Even"/"Odd" selection.

&lt;% @patients.each do |patient| %&gt;
  &lt;%= content_tag :tr, :class =&gt; cycle('Even', 'Odd') do %&gt;
    &lt;%= content_tag :td, link_to(patient.id, patient) %&gt;
    &lt;% [:username, :first_name, :last_name, :email, :active, :disabled].each do |property| %&gt;
      &lt;%= content_tag :td, patient.user.send(property) %&gt;
    &lt;% end %&gt;
    &lt;td&gt;
      &lt;ul class="Horizlist"&gt;
        &lt;%= content_tag :li, link_to('Detail', patient) %&gt;
      &lt;/ul&gt;
    &lt;/td&gt;
  &lt;% end %&gt;
&lt;% end %&gt;


If you happen to use Haml, it looks quite nice. :)

- @patients.each do |patient|
  %tr{:class =&gt; cycle('Even', 'Odd')}
    %td= link_to(patient.id, patient)
    - [:username, :first_name, :last_name, :email, :active, :disabled].each do |property|
      %td= patient.user.send(property)
    %td
      %ul.Horizlist
        %li= link_to('Detail', patient)