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