2012-07-23 06:29:15 +00:00
|
|
|
NAME
|
|
|
|
----
|
2012-08-10 15:06:48 +00:00
|
|
|
mongoid-sequence
|
2012-07-23 06:29:15 +00:00
|
|
|
|
2012-07-23 06:31:01 +00:00
|
|
|
INSTALL
|
|
|
|
-------
|
2012-08-10 15:06:48 +00:00
|
|
|
gem install mongoid-sequence
|
2012-07-23 06:31:01 +00:00
|
|
|
|
2012-07-23 06:29:15 +00:00
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
|
2012-07-23 06:31:01 +00:00
|
|
|
````ruby
|
2012-07-23 06:29:15 +00:00
|
|
|
|
2012-08-10 15:06:48 +00:00
|
|
|
require 'mongoid'
|
|
|
|
require 'mongoid-sequence'
|
2012-07-23 06:29:15 +00:00
|
|
|
|
|
|
|
|
2012-08-10 15:06:48 +00:00
|
|
|
class Page
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Sequence
|
2012-07-23 06:29:15 +00:00
|
|
|
|
2012-08-10 15:06:48 +00:00
|
|
|
sequence :number
|
|
|
|
end
|
|
|
|
|
|
|
|
p Page.create.number #=> 1
|
|
|
|
p Page.create.number #=> 2
|
|
|
|
p Page.create.number #=> 3
|
2012-07-23 06:29:15 +00:00
|
|
|
|
|
|
|
|
2012-07-23 06:31:01 +00:00
|
|
|
````
|
2012-07-23 06:29:15 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2012-08-10 15:06:48 +00:00
|
|
|
mongoid_sequence is a pure mongoid sequence generator based on mongodb's
|
|
|
|
increment operator
|