This isn't done yet, I'm just looking for some guidance. I'm trying to get the association_pks plugin to support models with composite primary keys, and so far I've done right-side CPKs for both one-to-many and many-to-many associations. I don't think changing the actual plugin will be difficult, since three of my four test cases passed without even needing to modify the plugin, and the fourth required only minor changes.
The problem is testing, since to be thorough I'd like to support and test for (right|left|both)-side cpks on (one_to_many|many_to_many) associations, and I think the testing will get to be a mess. I think the mocking technique for returning records will become hard to use if I start cramming more queries into it, and I don't know what a good alternative would be. My method of testing the insert sql on the many_to_many setter test is also really hacky, and I'm not sure what to do there either (when I did some similar work in the nested_attributes plugin I was able to just override _insert in the model being tested, but there isn't a model here to do the same).
Expand the association_pks plugin to handle right-side composite prim…
If testing gets ugly it gets ugly, that's not a big deal as long as the implementation works. Sequel's test code isn't going to win awards for beauty. :) My philosophy is that specs/tests exist mainly to prevent regressions.
In addition to updating the extension specs, you should also update the integration tests in plugin_test.rb to handle composite keys (on left/right/both sides). For complex tasks, I usually write the integration tests before the extension specs, since integration tests are easier to write (you are only checking for correct results as opposed to SQL).
From a brief review of your pull request, what you have so far looks good. I'm closing now, but please push the rest of your patches and let me know when you are finished and I'll reopen, review and test.
Note that in the future, it's best not to submit a pull request until you have fully implemented the feature. If you have only partially implemented the feature and need feedback, just post on the sequel-talk Google Group. The advantage with that is that other people can also have a chance to review and offer advice.
Support for this got merged in 166b035.