So, I have the following model method:

def self.cupcake_report_list
     list = Schedule.find_all_by_division(2, :select =>
'schedules.team_id, schedules.cupcake', :order => :team_id)
     cupcakes = []
     list.each do |row|
       teamname = ConferenceRecord.find_by_team_id(row.team_id, :joins
=> [:team, :conference])
       cupcakes << {'name'=> teamname.team.name,
         'teamid'=> teamname.team_id,
         'cupcake' => row.cupcake,
         'conference' => teamname.conference.short_name,
         'confid' => teamname.conference_id}
   end
   return cupcakes
end

This returns and array of hashes:

120 rows: 0..119
Each row containing 5 hash key/values

Example:

test = cupcake_report_list

=> {"name"=>"Georgia Tech", "cupcake"=>"Jacksonville St.",
"conference"=>"ACC", "teamid"=>4, "confid"=>2}

What I want to do is sort the entire array by the name hash key so that
if I were to look within the array, it would like so:

test[0]
=> {"name"=>"Air Force", etc., etc., etc., etc.}
test[1]
=> {"name"=>"Akron", etc., etc., etc., etc.}
test[2]
=> {"name"=>"Alabama", etc., etc., etc., etc.}

etc..

I can't figure out a way to do that correctly by a specific hash key
within the array.

Any ideas on how I can accomplish this?

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