Ruby on Rails和MongoDB

Dim*_*mme 1 ruby rubygems ruby-on-rails mongodb mongodb-ruby

我有一个新的Ruby on Rails安装,我可以看到默认的开始页面.

我按照本指南将MongoDB安装到Rails.

现在我在运行时遇到此错误rake test:

**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
  You can install the extension as follows:
  gem install bson_ext

  If you continue to receive this message after installing, make sure that the
  bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.
Run Code Online (Sandbox Code Playgroud)

我已经安装了bson_ext gem,这意味着现在bson_ext不在我的加载路径中或者gems不是同一个版本.

负载路径在哪里?我该怎么改变它?如何检查宝石是否是同一版本?

Sea*_*ill 5

如果你正在使用Ruby on Rails 3+,你应该检查你的Gemfile中是否引用了bson_ext gem.

  • 在你的gemfile中添加行`gem"bson_ext"`然后从你的命令行运行`bundle update`. (2认同)