jgaskins / perpetuity

Persistence gem for Ruby objects using the Data Mapper pattern
http://jgaskins.org/blog/2012/04/20/data-mapper-vs-active-record/
MIT License
250 stars 14 forks source link

Add API to register adapters #38

Closed booch closed 10 years ago

booch commented 10 years ago

As discussed in #35. That PR can be closed if this one is merged.

I had some concern at first regarding the timing of the registration of the "standard" adapters. But register_standard_adapters is called when Perpetuity.data_source is called, so the adapter class will be loaded by then. (If they weren't, then the const_get in data_source would not have worked.)

I made sure that the registration will allow re-registering an adapter, as long as it's the same class each time. That will allow us to have the standard adapters register themselves whenever we want to do that.

jgaskins commented 10 years ago

Love it.