> I have a collection of Link instances; this model has a "Category" > attribute. I need to group them on the controller in order to show > them separated on the view. How can I do this nicely? >> foo = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4] >> groups = Hash.new{|h, k| h[k] = []} >> foo.each{|i| groups[i] << i} >> groups => {1=>[1], 2=>[2, 2], 3=>[3, 3, 3], 4=>[4, 4, 4, 4]} >> groups[3] => [3, 3, 3] -- Anurag Priyam http://about.me/yeban/