# Best way to share a plugin between different Rails application

**URL:** <https://www.ruby-forum.com/t/best-way-to-share-a-plugin-between-different-rails-application/176909>\
**Category:** Rails\
**Created:** [October 8, 2009, 12:08am UTC](https://www.ruby-forum.com/t/best-way-to-share-a-plugin-between-different-rails-application/176909 "2009-10-08T00:08:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [October 8, 2009, 12:08am UTC](https://www.ruby-forum.com/t/best-way-to-share-a-plugin-between-different-rails-application/176909/1 "2009-10-08T00:08:56Z")

</div>

Hello list,

Ok, so this issue might be a topic for a design pattern that has already  
been discussed a lot around the Rails community, but the information I  
found  
is too disperse, and I would like some specific advice if possible.

I have a project that consists of several Rails applications. Actually  
we  
got this project with the “please save me” metadata. We are refactoring  
it  
to follow best practices and have a better maintenance factor.

So, each rails app, from the client perspective, is a “module”. Each app  
implements a different part of the system, but still needs artifacts  
from  
the others (higher-level artifacts, that are common between all of  
them),  
and here’s where the problem lies, _everything is duplicated_ across all  
these apps: models, controllers, helpers, views, migrations. A true  
maintenance hell.

So, what I’m politely asking here is, the ways to solve this Wet  
problem,  
i.e, DRYing it up.

The way I thought to approach the problem so far is to use Rails engine  
\*to  
package all the artifacts (models, controllers, migrations, and any  
other  
class/asset) in one Rails plugin. So far so good. It is a good proven  
solution, since Rails engine has been around for quite some time and has  
proven to work well.

What I still don’t know is how to share this plugin among the apps. I  
see  
two ways:

1. As a git submodule. So, the plugin would be in vendor/plugins, but as  
a  
git submodule;
2. In a central location, still version-controlled of course, but the  
sharing wouldn’t be done via git submoduling, but instead, I would tell  
each  
application to load this additional plugin from this outside location.

I would like some advice on this, any suggestion/idea is very welcome!

Thanks,

Marcelo.

---

<div class="post-metadata">

**Author:** ![mhfs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b2d939/32.png) [@mhfs](https://www.ruby-forum.com/u/mhfs)\
**Post date:** [October 8, 2009, 12:14am UTC](https://www.ruby-forum.com/t/best-way-to-share-a-plugin-between-different-rails-application/176909/2 "2009-10-08T00:14:12Z")

</div>

> application to load this additional plugin from this outside location.

1. braid. [GitHub - cristibalan/braid: Simple tool to help track vendor branches in a Git repository.](http://github.com/evilchelu/braid)

I’m not sure it really matters though…
