This post is part of a series of 31 Rails 4 articles being released each day in December 2012.
Before Rails 3, most Rails plugins were installed into the codebase of your project in the
vendor/plugins directory. This resulted in gems such as piston, that were used to pull updates from the plugin code repositories into your project. This workflow was highly inefficient.
As of Rails 3, the recommended approach to share plugins was to distribute them as gems. Rails 4 is doing away with the legacy style of plugins altogether.
In the last couple of years using Rails 3, I haven't had to resort to using a single legacy plugin. However, if your project is still dependent on
vendor/plugins, take one of the following steps:
- Attempt to find a gem alternative.
- Convert the plugin into a gem.
- Move the plugin to your lib folder(
lib/plugin_name/*), and create an initializer to require it in your Rails 4 project.
- Remove the dependency altogether
Below are some links to help you learn how to convert existing plugins and create your first Ruby gem: