views:

49

answers:

2

This is a noob question:

How do I add gems to my rails app in a way that I can just copy my app's directory structure to a remote location and have it just work, with all the gems I depend on installed and available?

A: 

gems path in a directory is

RAILS_ROOT/vendor/gems

you have to freeze/unpack all the gems used in this directory

Rails gems and there dependancies path will be

RAILS_ROOT/vendor/rails

And all plugins path should be

RAILS_ROOT/vendor/plugins

By default Rails load the gems form the machine (or you can say local). to load gems from the gems directory you have to add following code in tour config/enviorment.rb

  config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir| 
    File.directory?(lib = "#{dir}/lib") ? lib : dir
  end
Salil
+1  A: 

The future-proof solution is to use Bundler, which is required in Rails 3 and can be used right now in Rails 2.

x1a4