From: Hal Fulton Date: 2005-04-22T07:46:38+09:00 Subject: Re: for .. in .. else? Ryan Leavengood wrote: > > The above works (I tested it) but I think this is more Rubyish: > > > > > > <% if song_list.empty? %> > > > > <% else song_list.each do |song|%> > > > > <% end %> > <% end %> > >
Songs
no songs!
<%= song.name %>
> > i.e. get rid of the for entirely. I don't object to the 'for' (although I know some don't like it). FWIW I'll offer this (untested) alternative: <% unless song_list.each do |song|%> <% end.empty? %> <% end %>
Songs
<%= song.name %>
no songs!
Hal