Here's the scenario: small closed-source project that needs to share a certain model across multiple Rails apps. Basically there's one DB and multiple apps reading/writing to it in different ways, but all through that same interface. I would like to have the code for this DAL be implemented in only one place and shared somehow with all of the projects that need it.
What is the optimal way of doing that with the latest Rails version, assuming I'm using git as VCS? The three contenders you always read about are gems (which I understand can be created for internal use only, given you host your own gem server), Rails plugins and git submodules.
I haven't been able to find an overview of why, given all three options, one might want to pick one over another. I was hoping you folks might help me out!
Thank you!
I suggest you use gems, and bundle them in your application. We are using several private gems and keep them in the vendor/cache directory.
Plugins are deprecated, and will be removed. (Rails 4.0 I believe will remove them) They also cause warning spew.
Using a submodule is an interesting idea, but I would still stick with a gem.
Encapsulating some common code into a gem is a good practice nowdays. There's a Gemfury, proclaiming itself as a "private gem cloud server", which provides a service of storing private gems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With