Using MongoMapper with Rails 3

There is a really nice introduction at the MongoDB site on How to get started with MongoDB and Rails 3. I used this as a starting point but had to do a few more things before I was fully satisfied and got things running with MongoMapper. At the time of writing this the official repository is not Rails 3 compatible (because it does not implement the ActiveModel interface, yet), so I had to go with the rails3 branch of merbjedi’s repository. Use the following line to add the dependency to your Gemfile:

And while you are at it, add this line to include some handy generators for Rails 3, including one for MongoMapper models:

To use the generator set the orm config in your config/application.rb to :mongomapper

… and you are good to go!

btw: If you are like me and you prefer to have some kind of GUI for quick database lookups, check out MongoHub. It is in a very early stage of development, but at least you get to see your databases and documents.

iPhone app for GitHub


is GitHub in your pocket: The go to app for staying up to date with your projects on your iPhone, and iPod Touch.
It is