On Thu, Nov 12, 2009 at 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 > Tony, you should be able to do something like this: <% for task in tasks %> ... <% tag :hr unless task == tasks.last %> <% end %> Good luck, -Conrad > -- > Posted via http://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 -~----------~----~----~----~------~----~------~--~---

