ruby – 缺少mysql2 gem.将它添加到您的Gemfile:gem’mysql2′

版本

>ruby1.9.2-p290

> rails 3.0.9

> rvm下的mysql2-0.2.13

> ubuntu 11.04

gem安装了“gem install mysql2 -v’<0.3'”.所有依赖都得到满足. 铁轨& ‘rails c’工作正常. 我需要使用activerecord 3.0.9在rails环境之外运行脚本.当我运行脚本时,这是输出: ======================

/home/ross/work/x/library/models.rb:27:in `eval': !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2' (RuntimeError)
    from /home/ross/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/active_record/connection_adapters/mysql_adapter.rb:19:in `mysql_connection'
    from /home/ross/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `new_connection' ....

=======================

很明显,宝石就在那里,因为铁轨有效.

不知道为什么在运行脚本时找不到gem?

任何人都可以对这个问题有所了解吗?

问候

罗斯