Skip to content

A sample application to demonstrate how to use MongoDB with Rails 3 via MongoMapper

Notifications You must be signed in to change notification settings

flamontagne/mongomapper-rails3-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A sample application to demonstrate how to use MongoDB with Rails 3 via MongoMapper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published