tasks.each_with_index do |task, index| ... <%= content_tag(:hr) unless index == tasks.size %>
might need a +1 on either of index or .size, but that's the idea. -eric On Nov 12, 5:58 pm, Tony Tony <[email protected]> wrote: > Hi all, > > I need a very similar functionality to what is displayed on the group_by > Month railscast (http://railscasts.com/episodes/29-group-by-month). > > The code is this... > > <% @task_months.sort.each do |month, tasks| %> > <h2><%= month.strftime('%B') %></h2> > <% for task in tasks %> > <div class="task"> > <strong><%= task.name %></strong> > due on <%= task.due_at.to_date.to_s(:long) %> > </div> > <% end %> > > <hr/> <!-- THIS IS WHAT I NEED TO NOT DISPLAY ON TH LAST RECORD --> > > <% end %> > > The HR tag above is what I need to not show in the page. I know I could > this easily in a for loop with something like: > > <% for task in tasks %> > <%= '<hr/>' unless task == tasks.last %> > ... > > Anyone have any clue how to do this with an each loop? > > Many thanks! > -Tony > -- > Posted viahttp://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

