group by attributes

Matt Rose wrote:

> <% for $thing in $things %>

  I meant <% for thing in @things %> , of course

--
Posted via http://www.ruby-forum.com/.

try this...

groups = @things.group_by {|x| x.date}

groups.inspect #=> { 'date1' => [ array of items with date1], 'date2'
=> [array of items with date2] }

_Kevin