Best way to use common code for multiple applications ?
I would like to know the best way to use common code for multiple applications ? Basically I am working on two applications those two are build on top of third party APIs . I want to extract the common logic for maintenance. Please let me know your thoughts .
Depending on what you're doing it may be worth extract the code into a Gem or an Engine.
Git Submodules is also a viable option. I've started using them to share common CSS and JS code between different rails apps.
In that case Gem or Engine is probably your best option. Check out this tutorial for some ideas on how engines could be used :) https://pchm.co/posts/tutorial-how-to-build-a-cms-in-ruby-on-rails
As other say, create a gem.
Note: A Rails engine is just a gem with a type of setup that allows it to integrate with a Rails app. If the code is just plan ol' Ruby, life is even simpler. Follow one of the tutorials listed above, the RubyGems first gem tutorial, or the Rails plugin tutorial. Rails plugins are helpful if you're not using an Engine, but still want to test your code in the context of a Rail app.