Permalink
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (37 sloc) 1.37 KB

This fork

This fork replaces BSON::ObjectId to auto incremented id in MongoMapper documents

This fork is based on github.com/phstc/mongomapper_id2

It was submitted as pull request github.com/jnunemaker/mongomapper/pull/200

Usage

# app/models/movie.rb
class Movie
  include MongoMapper::Document

  key :title, String
  # Here is the fork
  auto_increment!
end

movie = Movie.create(:title => 'The Simpsons Movie')
movie.id # 1

movie2 = Movie.create(:title => 'Pirates of Silicon Valley')
movie2.id # 2

MongoMapper

A Ruby Object Mapper for Mongo.

Install

$ gem install mongo_mapper

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 in another branch so I can ignore when I pull)

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

Development

$ gem install bundler (if you don't have it)
$ bundle install
$ bundle exec rake

Problems or Questions?

Hit up the google group: groups.google.com/group/mongomapper

Hop on IRC: irc://chat.freenode.net/#mongomapper

Copyright

See LICENSE for details.