code4lib / ruby-oai

a Ruby library for building OAI-PMH clients and servers
MIT License
62 stars 43 forks source link

Add configurable `identifier_field` analagous to existing `timestamp_field`. #76

Closed jrochkind closed 5 years ago

jrochkind commented 5 years ago

You may not always want it to be assumed to be id. Now it's customizable, like timestamp_field is.

And the ActiveRecordWrapper is enhanced to use it properly, so you can use a field other than your primary key for what gets turned into the oai-pmh identifier.

There is a limited tests of ActiveRecordWrapper using this new func with GetRecord. More tests would be good, but it's challenging with the current test architecture. Note that custom timestamp_field also has limited (possibly no?) testing, either in general or with ActiveRecordWrapper.

This change should be entirely backwards compatible.

@jrochkind did need this for his use case.

Ref #61