On 1/31/06, David M. email@example.com wrote:
have more than one role in each subject.
Is it possible to use the Scaffolding Extensions plugin in this
scenario to manage this HABTM data?
No, it’s currently fairly prude, it couldn’t cope with a 3-way. I’d
look at the scaffold_habtm function in the plugin to get an idea of
how to do what you want.
If I were to add a 3-way scaffolding function (scaffold_3way), here’s
how I envision it working:
The view for edit_person_subjects_roles would have 3 select boxes:
- A multiple select box with all subjects
- A multiple select box with all roles (in your case you might want
this to be singular)
- A multiple select box with the subject-role pairs that are already
associated with the person
Clicking on update would remove the subject-role pairs from the
subject-role pairs select box, and add new subject-role pairs using
the combination of subjects and roles selected from the subjects
select box and the roles select box.
The scaffold_3way function would create the following views which all
would work similarly:
There is significant additional complexity for three way relationships
that you would need to work out, but it should be manageable. It
sounds like a fun project, though I don’t think there are nearly as
many applications as there are for the regular habtm scaffolding.
For bonus credit, you could further extend the idea to handle n-way
scaffolding, which would be a real trip.
Anyway, if you need any help, please let me know. If you get it
working and want it added to the Scaffolding Extensions plugin, I’d be
amenable to that.