The ordered hash is already sorted by responsibility, so you would
sort each area something like this: (tags removed)
@areas.group_by(&:responsibility).each do |responsibility, areas|
responsibility.name
areas.sort_by{|area| area.name}.each do |area|
...
A style suggestion: make yourself a method in class Area that returns
@areas_grouped_and_sorted. Less code in the view, and reusable.
On Dec 5, 6:50 pm, "Patrick Doyle" <[EMAIL PROTECTED]> wrote:
> @areas.group_by(&:responsibility).each do |responsibility, areas|
> <p><%=h responsibility.name %></p>
> <% areas.each do |area| %>
> ...
>
> I see that #group_by iterates through my list of areas, splitting them into
> sets according to which ones have the same responsibility.
>
> I would like to sort the results of that list.
>
> It seems to me that group_by returns an OrderedHash. How to I sort those
> results prior to passing the |responsibility, areas| pairs?
>
> --wpd
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---