With default routing in place, it would seem to me to be something on
the order of the following, given courses, students, and rosters:
course
has_many rosters
has_many students through rosters
student
has_many rosters
has_many courses through rosters
roster
belongs_to course
belongs_to student
-----
You need to pass the course_id to the roster in a param, like:
http://localhost:3000/rosters?course_id=1
which would allow a roster to determine which course it was for, and
retrieve all the appropriate students.
def show
@rosters = Roster.find(:all, :conditions => [''course_id =
?'',
params[:course_id]])
end
There are many other ways to organize and get at this information, such
as a partial for the course ''show'' form, like
''_course_students.html.erb'', which could just loop through the
@course.students collection to display the list of students.
--
Posted via http://www.ruby-forum.com/.