Take the 2-minute tour ×

I have a 2 different rails project, and I want to share my models among them. How could I achieve this?

I am considering a gem or sub-modules.

share|improve this question
Personally, I'd factor them out into a gem or engine. If you want a more detailed explanation, I'll expound this into a full answer. –  AlistairIsrael Mar 8 '13 at 7:51
add comment

2 Answers

up vote 5 down vote accepted

Extract the common code to a gem, or at the very least into a library structure (maybe in /lib ...) that you can isolate and manually include into your two projects.

share|improve this answer
+1 although in my experience it turned out a bit cumbersome. –  ch4nd4n Mar 9 '13 at 11:29
add comment

I suppose when you say share models, you imply activerecord models. You can create symlink to folder. Or something similar has been asked at Share Models between 2 Rails API's (Separate Applications)

share|improve this answer
add comment

Your Answer


