I downloaded the mongo_mapper gem and it installed successfully. Now, I am using it in my app and it always throws exception "No file to load mongo_mapper". What is that supposed to mean?
require 'mongo_mapper'
include mongo
UPDATE: After using require 'rubygems' first. My original problem is gone now there is another weird problem:
I get the following:
**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 already installed bson_ext but it keeps throwing this exception!
UPDATE 2: bson warning is now gone but I am not able to list the items in the Customers collection.
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