D
Douglas Livingstone
In my erb templates, I've got this pattern quite often:
<table>
<th>Songs</th>
<% for aSong in songList %>
<td><%= aSong.name %></td>
<% end %>
<% unless songList.empty? %>
<td>no songs!</td>
<% end %>
</table>
Is there any way to write is more like this:
<table>
<th>Songs</th>
<% for aSong in songList %>
<td><%= aSong.name %></td>
<% else %>
<td>no songs!</td>
<% end %>
</table>
Thanks,
Douglas
<table>
<th>Songs</th>
<% for aSong in songList %>
<td><%= aSong.name %></td>
<% end %>
<% unless songList.empty? %>
<td>no songs!</td>
<% end %>
</table>
Is there any way to write is more like this:
<table>
<th>Songs</th>
<% for aSong in songList %>
<td><%= aSong.name %></td>
<% else %>
<td>no songs!</td>
<% end %>
</table>
Thanks,
Douglas