Skip to content

Instantly share code, notes, and snippets.

View ShogunPanda's full-sized avatar

Paolo Insogna ShogunPanda

View GitHub Profile
@ShogunPanda
ShogunPanda / sequence.rb
Created July 16, 2011 11:15 — forked from masatomo/sequence.rb
adds a feature to set sequence number to Mongoid::Document
# encoding: utf-8
module Mongoid
# Include this module to add automatic sequence feature (also works for _id field, so SQL-Like autoincrement primary key can easily be simulated)
# usage:
# class KlassName
# include Mongoid::Document
# include Mongoid::Sequence
# ...
# field :number, :type=>Integer
# sequence :number