Trying something new .. HAML... I saw it a couple years ago, I was like "ehh.. umm.. nah" ... But working on the DevChix site, it seems like it will be our choice instead of erb for templates so I thought I'd give it a try.

So here's some straight up html + erb

RUBY:
  1. <h1>Listing users</h1>
  2.  
  3. <table>
  4.   <tr>
  5.     <th>Username</th>
  6.     <th>Email</th>
  7.   </tr>
  8.  
  9. <% @users.each do |user| %>
  10.   <tr>
  11.     <td><%=h user.username %></td>
  12.    <td><%=h user.email %></td>
  13.     <td><%= link_to 'Show', user %></td>
  14.     <td><%= link_to 'Edit', edit_user_path(user) %></td>
  15.     <td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
  16.   </tr>
  17. <% end %>
  18. </table>
  19.  
  20. <%= link_to 'New user', new_user_path %>

And same with haml:

RUBY:
  1. %h1 Listing users
  2.  
  3. %table
  4.   %tr
  5.     %th Username
  6.     %th Email
  7.  
  8. - @users.each do |user|
  9.   %tr
  10.     %td
  11.       = user.username
  12.     %td
  13.       = user.email
  14.     %td
  15.       = link_to 'Show', user
  16.     %td
  17.       = link_to 'Edit', edit_user_path(user)
  18.     %td
  19.       = link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete
  20.  
  21. = link_to 'New user', new_user_path

I am not totally sold, but.. it is an interesting kind of markup!

Let me know if you see a better way to write it or if you prefer another markup language!