# How to share a collection of model files across many apps?

**URL:** <https://www.ruby-forum.com/t/how-to-share-a-collection-of-model-files-across-many-apps/89897>\
**Category:** Rails\
**Created:** [March 23, 2007, 4:29pm UTC](https://www.ruby-forum.com/t/how-to-share-a-collection-of-model-files-across-many-apps/89897 "2007-03-23T16:29:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eblatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7bcc69/32.png) [@eblatt](https://www.ruby-forum.com/u/eblatt)\
**Post date:** [March 23, 2007, 4:29pm UTC](https://www.ruby-forum.com/t/how-to-share-a-collection-of-model-files-across-many-apps/89897/1 "2007-03-23T16:29:57Z")

</div>

Hi,

I’ve got three files that (a.rb, b.rb, c.rb) that currently live in  
app/models.  
I’d like these models to shared by multiple rails apps. These models are  
associated with a separate database.

My rails projects are contained in a directory that looks like this:

projects/

proj1/ proj2/ proj3/ common/

common/  
a.rb b.rb c.rb

My idea is to do this:

In proj1/lib/, symlink to …/…/common/

lib/  
common/ (which is a symlink)

My question is:  
How do I tell rails to load the files pointed to by the symlink named  
‘common’ in the lib directory?

I’ve tried:

cofig/environment.rb

include ‘lib/common’

Thanks for your input.  
EB

---

<div class="post-metadata">

**Author:** ![eblatt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7bcc69/32.png) [@eblatt](https://www.ruby-forum.com/u/eblatt)\
**Post date:** [March 23, 2007, 7:24pm UTC](https://www.ruby-forum.com/t/how-to-share-a-collection-of-model-files-across-many-apps/89897/2 "2007-03-23T19:24:02Z")

</div>

Are they not loading just by virtue of being in lib? I dunno. If not,  
then  
you should be able to modify that little piece of the environment.rb  
that  
says

# config.load\_paths += %W( #{RAILS\_ROOT}/extras )

to suit your needs. I’d hope.

RSL
