Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3 app deployment, Bundler & Rake issues

Deploying a Rails3 app, and am having some issues getting rake to find the gems installed by 'bundle install --deployment':

$ rake db:migrate
(in /home/jrdev/rails/testapp)
rake aborted!
!!! Missing the mysql2 gem. Add it to your Gemfile: gem ‘mysql2’

But, that gem in is the Gemfile, and is also in the vendor/bundle folder…

$ bundle show mysql2
/home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/gems/mysql2-0.2.6

My .gemrc file:

gemhome: /home/jrdev/.gems
gempath:
- /home/jrdev/.gems
- /usr/lib/ruby/gems/1.8

I thought rails3 apps already had the bundler code to detect which gems to use? I know I'm using the right rake, too (rake db:migrate --trace starts in /home/jrdev/rails/testapp/vendor/bundle/ruby/1.8/bin/rake). Same result using bundler's exec.

:(

like image 429
joraff Avatar asked Dec 03 '10 20:12

joraff


People also ask

Does Rails come with bundler?

Bundler: How to use Bundler with Rails. Rails comes with baked in support with bundler.

What is the difference between bundle and bundler?

The executables bundle & bundler have the same functionality and therefore can be used interchangeably. You can see in the bundler/exe directory that the bundler executable just loads the bundle executable. It seems to me that the bundle command is more commonly used than the bundler command.

Should bundler be in Gemfile?

In order to require gems in your Gemfile , you will need to call Bundler. require in your application. If some of your gems need to be fetched from a private gem server, this default source can be overridden for those gems.

What is the use of bundler in Rails?

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that you need. Bundler prevents dependencies and ensures that the gems you need are present in development, staging, and production.


1 Answers

Wouldn't you freaking know I solve it a minute after asking.

My database.yml file was still calling the 'mysql' adapter instead of 'mysql2'.

Still, what an OBSCURE error message!

like image 173
joraff Avatar answered Oct 28 '22 17:10

joraff