Rails: Installing a Gem to Plug-ins

Installing a gem to vendor/gems is easy. The basic steps are:

  1. Unpack the gem
1
2
$ cd vendor/gems
$ gem unpack oauth
  1. Add the gem to your config load path in config/environment.rb
1
2
3
config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
  File.directory?(lib = "#{dir}/lib") ? lib : dir
end

Benefits are easier debugging and removing gem dependencies.

Click here for more details.

Comments