No commit activity in last 3 years
No release in over 3 years
Makes it easy to sign Mongoid documents based on a subset of fields to prevent duplicate documents.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
>= 0

Runtime

>= 2.0.0
 Project Readme

Sign mongoid documents to prevent duplicates.

Requirements¶ ↑

  • mongoid (>= 2.0.0.rc7)

Install¶ ↑

To install mongoid_signature, simply add it to your Gemfile:

gem 'mongoid_signature'

In order to get the latest development version of mongoid_signature:

gem 'mongoid_signature', :git => 'https://github.com/connectedbits/mongoid_signature.git'

And then:

bundle install

Usage¶ ↑

Add the include Mongoid::Signature in the model:

class User include Mongoid::Document include Mongoid::Signature

field :name field :email

references_many :posts references_many :comments

sign_document :include => [:name] end

class Post include Mongoid::Document include Mongoid::Timestamps include Mongoid::Signature

field :title field :body field :published, :type => Boolean, :default => false

referenced_in :users embeds_many :comments

sign_document :include => [:user, :title, :body] end class Comment include Mongoid::Document include Mongoid::Timestamps include Mongoid::Signature

field :body

embedded_in :post referenced_in :user

sign_document :include => [:user, :body] end

Signing¶ ↑

This will add a signature field to your document and provide additional signature_string and sign! methods:

>> @user = User.new(:name => ‘Eric’) => #<User _id: 4d66a345bf354104bd000002, name: “Eric”, signature: nil, email: nil> >> @user.sign! => “535d6fcc4483b2d02167d2d4bc05fdff5e34f6538ac6fa897c63b11d8417e815”

Known issues¶ ↑

See github.com//mongoid_signature/issues

Repository¶ ↑

See github.com/connectedbits/mongoid_signature and feel free to fork it!

Contributors¶ ↑

See a list of all contributors at github.com/connected/mongoid_signature/contributors. Thanks a lot everyone!

Copyright © 2011 Connected Bits, LLC. See LICENSE for details.