2

I'm starting a Rails tutorial that tells me to edit the gemfile when creating a new demo app:

source 'https://rubygems.org'

gem 'rails', '3.2.3'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem :development do
gem 'sqlite3', '1.3.5'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.4'
  gem 'coffee-rails', '3.2.2'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platform => :ruby

  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.0'

group :production do
    gem 'pg', '0.12.2'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'  

When I try to bundle install the file, using bundle install --without production, as per the instructions, I get this error:

You need to specify gem names as Strings. Use 'gem "development"' instead.

When I return to the file and change gem :development into gem "development" I'm instead told:

Could not find gem 'development (>= 0) ruby' in the gems available on this machine.

I'm new to this and really have no idea what to do when one set of clear instructions seems to clash with another and neither works, especially because I don't really understand what any of these terms mean.

Help would be very much appreciated,

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Sasha
  • 6,224
  • 10
  • 55
  • 102

1 Answers1

8

:development should be a group, not a gem. Try with this:

group :development do
  gem 'sqlite3', '1.3.5'
end

This means that all the gems inside the development group should be loaded in the development environment. In this case, you won't have the sqlite gem when running in production or test.

The same applies to the production group.

The assets group is loaded only when compiling the assets for the Asset Pipeline.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
alf
  • 18,372
  • 10
  • 61
  • 92
  • 1
    Oh. Awesome. I'm an idiot for not seeing that. Thanks SOOO much (for the explanation too). – Sasha May 26 '12 at 01:45