MongoMapper 和 bson_ext 问题
我无法让 MongoMapper 与我的 Rails 应用程序一起使用。我收到此错误消息:
**注意:C 扩展未加载。这是最佳 MongoDB Ruby 驱动程序性能所必需的。 您可以按如下方式安装扩展: gem install bson_ext
如果安装后继续收到此消息,请确保 bson_ext gem 在您的加载路径中,并且 bson_ext 和 mongo gem 具有相同版本。
我已经安装了 DevKit 并安装了 gem: gem install bson_ext --no-rdoc --no-ri (结果:安装了 bson_ext-1.0.1)
我在 Windows 7 上运行。Rails 版本是 2.3.7。我在安装时使用了RubyInstaller。有人能指出我正确的方向吗?
I can't get MongoMapper to work with my Rails app. I get this error message:
**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.
I have installed DevKit and installed the gem: gem install bson_ext --no-rdoc --no-ri (result: bson_ext-1.0.1 installed)
I'm running on Windows 7. The Rails version is 2.3.7. I used the RubyInstaller when installing. Can anyone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
问题是:bson_ext gem 版本和 mongo gem 版本需要匹配,而且 mongo_mapper 还没有准备好 mongo-1.0.1,因此您应该使用的 mongo 和 bson_ext gem 版本均为 1.0,分别。
因此,请执行以下操作:
然后,对于 Rails 2.x,在 config/environment.rb 中执行:
或对于 Rails 3,在 Gemfile 中执行:
The problem is: the bson_ext gem version and the mongo gem version need to match, also, mongo_mapper isn't ready for mongo-1.0.1 yet, so the versions of the mongo and bson_ext gems you should be using are 1.0 for each, respectively.
so, do the following:
then for Rails 2.x in your config/environment.rb do:
or for Rails 3, in your Gemfile:
这一般是由于安装的bson_ext版本不等于MongoMapper所需的版本号导致的。检查需要哪个版本的 bson MongoMapper,然后确保您拥有该版本且没有安装其他版本。
This is generally caused by installing a version of bson_ext not equal to the version number required by MongoMapper. Check which version of bson MongoMapper is requiring, and then make sure that you have that version and no other installed.
我需要指定 bson 版本才能使其正常工作,如下所示:(
使用 Rails 3)
I needed specify the bson version to get this to work, like so:
(Using rails 3)
我按照上面的说明进行操作,但仍然是“没有这样的文件来加载‘bson_ext’”。我转到 gem 并尝试将“ext”文件夹中的文件夹向上移动一级(到 gem 的根目录),瞧,它起作用了。
I followed the instructions above but still the "no such file to load 'bson_ext'. I went to the gem and tried moving the folders in the "ext" folder up one level (to the root of the gem) and lo and behold, it worked. FWIW...
在您的环境中包含以下内容.rb
Include the following in your environment.rb
安装
bson_ext
使用:将 gem 添加到您的
Gemfile
:在项目根级别目录中运行
bundle
。Install
bson_ext
using:Add the gem to your
Gemfile
:Run
bundle
in your project root level directory.