This is a very simple Rails 3 sample application that demonstrates how to use MongoMapper and play with the MongoDB database engine.
There are 2 models: Book and Author. I just wanted to demonstrate how to do associations ala ActiveRecord.
I have followed this exellent tutorial to get me started.
Install the MongoDB (server and client) for your platform www.mongodb.org/downloads
Gems (mongo, MongoMapper and bson_ext)
The Gemfile has a “require 'mongo'” clause just before the gem command to ensure that a dependency (bson_ext) is correctly loaded. FOr this reason you have to install mongo before running bundle install.
sudo gem install mongo
Since we're not using ActiveRecord, we have to specify the –orm option when generating a model. For example: rails generate model Book –orm mongo_mapper
At the moment, the model generator does not exist in the gem itself so I use the rails3-generators gem (github.com/indirect/rails3-generators) instead.