Alex Rivera | Logout

How to use conditionals in Gemfile

Asked 2011-03-16T09:49:08.493
14

I have these groups in my Gemfile:

group :development, :test do
   gem 'sqlite3'
end
group :production do
  gem 'mysql'
end

The development machine does not have MySQL installed, which is why I have only listed MySQL in the production group. But when I try to run Rails on the development machine I get this:

$> RAILS_ENV=development ./script/rails 
Could not find gem 'mysql (>= 0, runtime)' in any of the gem sources listed in your Gemfile.

Obviously I could fix this by installing MySQL, but I would like to know the correct solution instead of installing unneeded software.

Edit
Report

1 Answer

2

did you rerun "bundle install" after changing your Gemfile?

answered 2011-03-16T15:01:21.363

Your Answer