This is the trick: I have to fix this without touching the Gemfile. I'm currently creating my working environment so that it matches the production server, so, I cannot modify the rails' code at all.
My OS: OSX 10.11
Ruby: ruby 2.0.0p643
The gem is the Gemfile as gem 'mysql2'. There are no errors when doing bundle install, but when I try to rake db:migrate --trace this is the output:
There was an error while trying to load the gem 'mysql2'.
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/redar/.rvm/gems/ruby-2.0.0-p643/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
/Users/redar/redar/config/application.rb:7:in `<top (required)>'
/Users/redar/redar/Rakefile:4:in `<top (required)>'
This will make sure that you are executing "rake db:migrate" with the gems listed in the Gemfile loaded and available. If you run it without "bundle exec" you may be executing only with the system gems available.
Asked in February 2016Viewed 3,997 timesVoted 6Answered 1 times