I have several rails applications that I want to combine into a single application using rails engines. Many of the models appear in multiple applications (now engines) and have some methods in common.
I want to make this code DRY, removing the code duplication that I now have. Ideally, I want a single instance of the common methods and still be able to test each engine independently. Where should I put the common methods?
I think the best solution would be to create a engine or gem for the shared classes.
Say you have a user model which has shared functions and application specific functions. I would put the base (shared) functionality into a base engine which is included in the feature engines. In each feature engine I would extend or add functionality to the the user class.
It seems a little like overkill if you are just extending one class, but if you have a set of shared features that other apps build on it would be a good approach to make dry and reusable.