Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Generators for use with the MongoMapper rubygem.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 features
Octocat-spinner-32 lib
Octocat-spinner-32 rails_generators
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 mongo_mapper_generators.gemspec


MMG is intended for use with the MongoMapper rubygem. Use it to generate Document and EmbeddedDocument models. Also included is a generator for a rails initializer.


MongoMapperGenerators is only released on gemcutter. To install, you can setup gemcutter as your default gem source.

$ gem install gemcutter
$ gem tumble

Then you can install MMG:

$ gem install mongo_mapper_generators

You can also just declare the source:

$ gem install mongo_mapper_generators -s


  • MongoMapper

  • Rails


Once you install the gem, the generators will be available to all Rails applications on your system. If you run script/generate without any additional arguments you should see the available generators listed.

To run the generator, go to your rails project directory and call it using the script/generate or script/destroy command.

script/generate mongo_model Person name:string email:string age:integer

It will generate the model, a unit test and a factory.

Generators also exist for generating EmbeddedDocument models as well as a rails initializer.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


I was inspired by a number of different sources, including:


Copyright © 2009 Steve Agalloco. See LICENSE for details.

Something went wrong with that request. Please try again.