code4lib / ruby-oai

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

Changes to ActiveRecordWrapper #6

Closed seandmccarthy closed 12 years ago

seandmccarthy commented 12 years ago

In trying to use ActiveRecordWrapper in a Rails Engine, I came across 2 issues.

1st, was "TypeError (can't convert Time into String)", caused by the argument to Time.parse being a Time object itself.

2nd was that even if I implement map_{prefix} in my model, if I used ActiveRecordWrapper to wrap my model, then when OAI::Provider::Metadata::Format.encode asked if model.respondto("map#{prefix}") it would be false. This is because "model" is an ActiveRecordWrapper and not the class of the wrapped model.

I've fixed both issues in this commit.

cbeer commented 12 years ago

Merged with a couple tweaks a68161e. I can't get the test suite to pass, though, so I suspect there may be more problems with ActiveRecordWrapper to come.