I have a Person model and a Phone model.
A person can have any number of phones.
A phone has two attributes: type and number.
A phone type could be any of the followings: Home Work Mobile Fax Other
A person can have multiple records of home phones or any other phone type.
While displaying the phones this is what I am doing.
<% @phones.group_by(&:type).sort.each do |type, phones| %>
<%= render :partial => 'phone, :collection => @phones %> <br />
<% end %>
But the problem is that it is returning phone numebers in the following order: Fax Home Mobile Office Work
I want the phone numbers to be displayed in the following order: Work Mobile Home Fax Other
What’s the best way to achieve that?