这让我发疯。
我正在尝试使用 ActiveRecord 创建一个简单的初学者应用程序来执行简单的数据库任务。我没有使用导轨。
我不断收到错误:
RuntimeError: Please install the mysql adapter: `gem install activerecord-mysql-adapter` (Could not find mysql (~> 2.8.1) amongst [actionmailer-3.1.3, actionpack-3.1.3, activemodel-3.1.3, activerecord-3.1.3, activerecord-sqlserver-adapter-3.1.4, activeresource-3.1.3, activesupport-3.1.3, ansi-1.4.1, arel-2.2.1, bigdecimal-1.1.0, builder-3.0.0, bundler-1.0.21, capistrano-2.9.0, coffee-rails-3.1.1, coffee-script-2.2.0, coffee-script-source-1.1.3, daemons-1.1.4, erubis-2.7.0, eventmachine-0.12.10, execjs-1.2.9, highline-1.6.8, hike-1.2.1, hpricot-0.8.5, i18n-0.6.0, io-console-0.3, jquery-rails-1.0.19, json-1.6.3, mail-2.3.0, mime-types-1.17.2, minitest-2.5.1, multi_json-1.0.4, net-scp-1.0.4, net-sftp-2.0.5, net-ssh-2.2.1, net-ssh-gateway-1.1.0, nokogiri-1.5.0, polyglot-0.3.3, rack-1.3.5, rack-cache-1.1, rack-mount-0.8.3, rack-protection-1.1.4, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.1.3, railties-3.1.3, rake-0.9.2.2, rdoc-3.11, rockhands-0.0.6, sass-3.1.11, sass-rails-3.1.5, shotgun-0.9, sinatra-1.3.1, sprockets-2.0.3, sqlite3-1.3.4, thin-1.3.1, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, turn-0.8.3, tzinfo-0.3.31, uglifier-1.1.0])
这种宝石显然不存在于 rubygems 上,否则这很容易......
我还应该怎么做呢?
这是重要的部分
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:database => 'test',
:username => 'root',
:password => 'password'
)
我可以看到我更改的任何内容:散列中的适配器是它插入到错误“gem install activerecord-yousuck-adapter”中的内容
我已经阅读了谷歌上我能找到的几乎所有指南......在我束手无策的情况下。我认为这至少会容易一点......我花了很多时间来修复宝石错误。事实上,我还没有编写任何实际的 ruby 代码。多么令人沮丧。