Tony Tony 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 %>

In addition to my other suggestion, you might consider using a <table> 
element instead of all the <hr>s.  Since this is a table of data, the 
semantics are more appropriate to the <table> element.

> 
> 
> 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

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to