Redo "sets" in ActiveRecord::Wrapper
jrochkind opened this issue · comments
ActiveRecord::Wrapper has some kind of built-in implementation for providing oai-pmh "sets".
But it is non-documented, and very confusing. It seems to be based on assuming that you will organize your records into sets using an actual rdbms fk/pk association (and corresponding ActiveRecord association), and/or with a String "set" column/attribute in your record table.
This seems not flexible enough, and making too many assumptions. The code is also somewhat convoluted, making lots of assumptions about your Models and making guesses. I was unable to figure out how to make tests even exersizing some paths in the code.
We should deprecate all the existing "set" stuff. And provide a new set implementation where the sets are defined on the Wrapper, rather than making assumptions about the model. They can probably conveniently make use of ActiveRecord "scopes" (methods that return relations) for the simple cases.
It should not require any additional methods (or db attributes/relationships) be added to your AR models, you should do the configuration in the wrapper class (and/or a custom sub-class of the wrapper class?)
This will probably not be done before 1.0.