HABTM - How do I do a select box for this?

I’ve got several habtm’s working fine in my app but have been having
trouble with a new twist: imagine an app that tracks students and
courses that they’re taking. So there’s a student Class and a course
Class, and the tables also, and a students_courses table. This stuff I
have down cold.

The problem was I wanted a form that allowed associating a student with
up to three courses, each individually selected from a drop-down select

Student: John
Course 1: (select box)
Course 2: (select box)
Course 3: (select box)

I tried the following for my select box code in my view (this is
pseudo-code, I don’t have the source with me):

<% select :student, :course_id, Course.find(:all) %>

The error I’m getting is with the second parameter above. I think I’ve
got that wrong. Is there any way to do what I’m doing? I think the
problem is that I don’t understand how to modify a collection of many
courses when I’ve got three separate select boxes. Thanks very much.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs