Now THAT is the ruby way!

-- Patrick


On Nov 22, 2006, at 11:55 am, <[EMAIL PROTECTED]> wrote:

Imagine the following:
## CONTROLLER
updates = Update.find :all # has the attribute date
grouped_updates = updates.partition_by {|u| u.date} # this will group
updates by date

## VIEW
<% grouped_updates.each_pair do |date,updates| -%>
<h3><%= date.to_s %></h3>
  <% updates.each do |update| -%>
    <!-- your display code for updates -->
  <% end -%>
<% end -%>
##

Use extensions, they kick ass!

-Jordan

_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to