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. 



On Monday, December 30, 2013 9:12:42 AM UTC-5, jsnark wrote:
>
> 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?
>
> Some pointers would be appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/1f8c53ec-f0e7-4931-8d4f-62e10acbd6a9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to