I'm in the process of setting up a centralised data management system + CAS for a series of apps that currently have duplicated data across many databases that is a nightmare to manage.
I've got the CAS system implemented nicely with rubycas-server and rubycas-client, but I'm running into problems when it comes to actually sharing the user data and other models between client apps. For example:
- CAS/Central system (share a DB) expose a base User as JSON
- App1 extends user with information about favourite colours
- App2 just cares about having a user
I want to be able to let App1 add the data it cares about the object returned from the API, without burdening App2 with that info.
I'm currently playing around with writing a gem for the client apps which can consume the JSON (with ActiveResource or ROAR, not sure which yet), however the client apps need to decorate/extend their models with additional data which is currently managed via ActiveRecord. So I'm not sure what the best way to go about extending those gem provided instances would be.
So far I've experimented a bit with having the gem contain a bunch of modules which the ActiveRecord models can then include, but this has issues when needing to deal with class methods (not insurmountable but any means). I've tried looking around for resources/guides for best practices in this sort of situation, but haven't been able to find anything.
tl;dr summary: Multiple client apps need to use and extend data provided by a JSON api. What's the recommended practice for doing this?