# ActiveRecord shared models

**URL:** <https://www.ruby-forum.com/t/activerecord-shared-models/163358>\
**Category:** Rails\
**Created:** [March 19, 2009, 3:44pm UTC](https://www.ruby-forum.com/t/activerecord-shared-models/163358 "2009-03-19T15:44:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [March 19, 2009, 3:44pm UTC](https://www.ruby-forum.com/t/activerecord-shared-models/163358/1 "2009-03-19T15:44:47Z")

</div>

I’m attempting to build a somewhat non-standard architecture around the  
Rails apps that I’m building for a customer. We’re looking for a way to  
be able to share models across projects using RubyGems.

The reasons we want to take this approach are:

1. Shared model logic, without duplication
2. Quick development of new applications
3. Small test suite per application
4. Mini-apps (potentially non-web) without full rails stack

I have seen solutions related to symlinking the app/models folders into  
each application or using svn:externals, but these both seem suboptimal.

Ideally, I’d like to be able to:

require ‘rubygems’  
require ‘models’

and have access to any of my models.

I have experienced some headaches with plugins and I expect to see more.  
Does anyone have any suggestions for implementing this type of  
architecture or am I doomed to have one monolithic Rails app?

Best,  
Michael G.

---

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [March 19, 2009, 4:12pm UTC](https://www.ruby-forum.com/t/activerecord-shared-models/163358/2 "2009-03-19T16:12:58Z")

</div>

On Thu, 19 Mar 2009 15:44:47 +0100  
Michael G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m attempting to build a somewhat non-standard architecture around the  
> Rails apps that I’m building for a customer. We’re looking for a way to  
> be able to share models across projects using RubyGems.

Have you tried the new plugin system in rails 2.3? It may not be exactly  
what you’re looking for, but it allows you to have models in plugins.

## SH

Starr H.  
Check out my Helpdesk RailsKit: [http://railskits.com/helpdesk/](http://railskits.com/helpdesk/)

---

<div class="post-metadata">

**Author:** ![mgreenly](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85f322/32.png) [@mgreenly](https://www.ruby-forum.com/u/mgreenly)\
**Post date:** [March 19, 2009, 4:24pm UTC](https://www.ruby-forum.com/t/activerecord-shared-models/163358/3 "2009-03-19T16:24:19Z")

</div>

Starr H. wrote:

> On Thu, 19 Mar 2009 15:44:47 +0100  
> Michael G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > I’m attempting to build a somewhat non-standard architecture around the  
> > Rails apps that I’m building for a customer. We’re looking for a way to  
> > be able to share models across projects using RubyGems.
> 
> Have you tried the new plugin system in rails 2.3? It may not be exactly  
> what you’re looking for, but it allows you to have models in plugins.

We have looked at this as a potential solution, however, it does not fit  
our requirement of being able to use models outside of the full Rails  
stack.

Best,  
Michael G.
