Best route for has_many subrecords


#1

Hello all,
I have a model, say it’s called Person, which has_many Responsibilities.
I
would like the “show” view for the person controller to list all of the
responsibilities for that person. (That’s the easy part – I think I
know
how to do that part.) At the end of the list, I would like to include a
text field into which a new responsibility may be added. What route
should
I use for the “Add” button next to that text box?

I am, perhaps, confused, because I’m using RESTful routing, and I can’t
figure out how to map this sort of action (add/update one of the
subrecords
of a has_many association) into a RESTful route. Perhaps wanting to do
this
sort of thing from the “show” view is not compatible with RESTful
routing.

I suppose I could create a controller just for the Responsibilities
model,
and I could nest the routes for that inside the routes for the Person
routes, but that seems like overkill, especially since I only need to be
able to create and edit responsibilities.

Or is it? Is that the “Rails Way” to do this sort of thing?

–wpd