Repository is archived
No commit activity in last 3 years
No release in over 3 years
Generators for use with the MongoMapper rubygem. Use to generate Documents, EmbeddedDocuments, and Rails initializer.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0.4.0
>= 2.10.2
 Project Readme

mongo_mapper_generators¶ ↑

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.

Install¶ ↑

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 http://gemcutter.org

Dependencies¶ ↑

  • MongoMapper

  • Rails

Usage¶ ↑

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.

Credits¶ ↑

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

Copyright © 2009 Steve Agalloco. See LICENSE for details.