method

gem

gem(name, options = {})
public

Adds a single Gem dependency to the rails application.

  # gem 'aws-s3', '>= 0.4.0'
  # require 'aws/s3'
  config.gem 'aws-s3', :lib => 'aws/s3', :version => '>= 0.4.0',      #     :source => "http://code.whytheluckystiff.net"

2Notes

Rake tasks for gem dependencies

Vidmantas · Aug 25, 20086 thanks

You can manage installation and other tasks for these dependencies with rake tasks, for example:

rake gems:install # Installs all required gems for this application rake gems:unpack # Unpacks the specified gem into vendor/gems

To get all rake tasks about gems:

rake -T gems

Version Ranges

slippyd · Dec 18, 20094 thanks

To specify a version range, use array syntax like this: config.gem 'paperclip', :version => ['>= 2.3.1.1', '< 3.0']

The example will, of course, match any version 2.3.1.1 or newer up until (not including) 3.0 or later.