A sample application to demonstrate how to use MongoDB with Rails 3 via MongoMapper
Ruby JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db
doc
lib/tasks
public
script
test
vendor/plugins
.gitignore
Gemfile
Gemfile.lock
README.rdoc
Rakefile
config.ru

README.rdoc

Description

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.

Requirements

MongoDB:

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

and then

bundle install

Other

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.