# Best way to share a plugin between different Rails application

**URL:** <https://discuss.rubyonrails.org/t/best-way-to-share-a-plugin-between-different-rails-application/46678>\
**Category:** rubyonrails-talk\
**Created:** [October 7, 2009, 10:07pm UTC](https://discuss.rubyonrails.org/t/best-way-to-share-a-plugin-between-different-rails-application/46678 "2009-10-07T22:07:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcelo\_de\_Moraes\_Se](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcelo\_de\_Moraes\_Se](https://discuss.rubyonrails.org/u/Marcelo_de_Moraes_Se)\
**Post date:** [October 7, 2009, 10:07pm UTC](https://discuss.rubyonrails.org/t/best-way-to-share-a-plugin-between-different-rails-application/46678/1 "2009-10-07T22:07:40Z")

</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:** ![Philip\_Hallstrom](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@Philip\_Hallstrom](https://discuss.rubyonrails.org/u/Philip_Hallstrom)\
**Post date:** [October 7, 2009, 10:12pm UTC](https://discuss.rubyonrails.org/t/best-way-to-share-a-plugin-between-different-rails-application/46678/2 "2009-10-07T22:12:56Z")

</div>

> 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.

3) 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...
