mongo_mapper gemをダウンロードし、正常にインストールされました。現在、アプリで使用していますが、常に「mongo_mapperをロードするファイルがありません」という例外がスローされます。それはどういう意味ですか?
require 'mongo_mapper'
include mongo
更新:最初にrequire'rubygems'を使用した後。私の元の問題はなくなり、別の奇妙な問題が発生しました。
私は次のようになります:
**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をインストールしましたが、この例外をスローし続けます!
更新2:bsonの警告はなくなりましたが、Customersコレクションのアイテムを一覧表示できません。
require 'rubygems'
require 'mongo_mapper'
include Mongo
MongoMapper.database = 'Northwind'
class Customer
include MongoMapper::Document
key :FirstName, String
key :LastName, String
key :UserName, String
end
customers = Customer.all
puts customers.count # this always is 0. It should be 1 since there is one item in the Customers collection
puts customers