Many to many in separate has_one controller

Hi.

I have a problem deciding the best way to manage a many_to_many
relationship.

It define the relationships as so:

[code]

models

student model

student has_many subjects :through => :enrollments

subject model

subject has_many students :through => :enrollments

enrollments model

belongs_to :student
belongs_to :subject[/code]
How can I have a separate controller to manage a students enrollments
from one page? Imagine a student page with radio buttons defining
their relationship with a subject, something like [enrolled, deferred,
cancelled] for example. This would surely be a one_to_one relationship
from a routing perspective. My idea was to define this extra
controller but I’m quickly thinking I’m going the wrong way with this.

map.resources :student, :has_one => :curriculum, :except => [:new, :create]
Within the controller and the view, what would the form_for be for?
There is no curriculum model, and I can’t have a form_for a
relationship (can I?).

Thanks in advance.

This is part of what has_many :through is for. You already have an
enrollments model, so you can just create a controller for it, adding
extra attributes where necessary (cancelled, etc.).

-eric

Thanks Eric. That sounds great.

How though would I create a form_for on a relation table. There is no
actual
object, or fields of an object.