Sorting data properly

Greetings all,

As a preface, I’m not actually a programmer, I’m a network
administrator. The ruby programmer at work just left to work at a
startup, and until a replacement can be found I’m trying to fill in. So
if I act ignorant, it’s because I am. Try and bear with me…

I’ve got a page that contains a bunch of data. For the list, the
controller has the following

def list
@schedules = Schedule.find :all,
:conditions=>[“date between ? and ?”,@starts, @ends],
:order=>‘date asc, period, collection_point_id, lane_type’,
:include=>‘collection_point’
end

On the view page, we have this (I think this covers the pertinent code)

<% @schedules.group_by{|s| s.date }.sort_by{|d,s| d}.each do |date,
schedules| %>

My problem is I need the data grouped by date, and then sorted by
period. Unfortunately, I can’t seem to get my head around iteration in
Ruby yet, so I’m not sure how to change sort_by call to make it work (in
fact, I’m not entirely sure what d and s are)

Any thoughts? I can post more code, but I’m not entirely sure what to
post. Full versions of the controller, model, and associated view are
all enclosed in the zip.

Thanks,
mike