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
is too disperse, and I would like some specific advice if possible.
I have a project that consists of several Rails applications. Actually
got this project with the “please save me” metadata. We are refactoring
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
the others (higher-level artifacts, that are common between all of
and here’s where the problem lies, everything is duplicated across all
these apps: models, controllers, helpers, views, migrations. A true
So, what I’m politely asking here is, the ways to solve this Wet
i.e, DRYing it up.
The way I thought to approach the problem so far is to use Rails engine
package all the artifacts (models, controllers, migrations, and any
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
- As a git submodule. So, the plugin would be in vendor/plugins, but as
- In a central location, still version-controlled of course, but the
sharing wouldn’t be done via git submoduling, but instead, I would tell
application to load this additional plugin from this outside location.
I would like some advice on this, any suggestion/idea is very welcome!