rails mysql gem problem on ubuntu
Ruby on Rails: I would like to call a controller on the localhost, but the server said !!! Missing the mysql 开发者_运维技巧gem. Add it to your Gemfile: gem 'mysql', '2.8.1'
The problem ? When I hit 'gem list' command then I got a list witch is containing the mysql 2.8.1 . So the gem is INSTALLED ! WHY can't it see by the webrick ?
Thank you.
You need to add the line gem 'mysql', '2.8.1'
to your Gemfile. Then type bundle install
in the root folder of your Rails project. It sounds like you forgot to run bundler.
The MySQL gem does require native C extensions. So you'll need to make sure that you have all the development libraries installed.
In Ubuntu you can do something like this:
sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo gem install mysql
If you are using rvm, do not install gems as sudo.
Just to make sure, you might also want to try removing your Gemfile.lock and then re-running bundle install
It seems that you are using Rails 3 which uses bundler to load all needed gem. You should add the gem to your Gemfile as instructed by the error message so that it will be loaded. Checkout the bundler project page for more information about the gem dependency tool and how to use it with Rails. http://gembundler.com/rails3.html
精彩评论