Ruby on Rails 和 MongoDB
我有一个新的 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.
我已经安装了 bson_ext gem,这意味着现在 bson_ext 不在我的加载路径中,或者 gem 不是同一版本。
加载路径在哪里?我怎样才能改变它? 如何检查宝石是否是同一版本?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的是 Ruby on Rails 3+,您应该检查 Gemfile 中是否引用了 bson_ext gem。
If you're using Ruby on Rails 3+, you should check that the bson_ext gem is referenced in your Gemfile.
打开 Gemfile(在 Rails 应用程序的根目录中)并添加一行:
bson_ext
您应该拥有:
此外,这里还有来自 10gen 文档 有关在 Rails 中运行测试的信息:
他们还引用了 John Wood 的帖子 这非常好。
Open up Gemfile (in your rails app's root directory) and add a line that says:
bson_ext
You should have:
Also here is some more info from 10gen docs on running tests in rails:
They also reference John Wood's post which is quite good.