README.rdoc in rs_voteable_mongo-1.0.0 vs README.rdoc in rs_voteable_mongo-1.0.1
- old
+ new
@@ -1,16 +1,15 @@
= Voteable Mongo (for Mongoid 3 / 4)
+{<img src="https://travis-ci.org/rs-pro/voteable_mongo.png?branch=master" alt="Build Status" />}[https://travis-ci.org/rs-pro/voteable_mongo]
+{<img src="https://gemnasium.com/rs-pro/voteable_mongo.png" alt="Dependency Status" />}[https://gemnasium.com/rs-pro/voteable_mongo]
+{<img src="https://badge.fury.io/rb/rs_voteable_mongo.png" alt="Gem Version" />}[http://badge.fury.io/rb/rs_voteable_mongo]
+
voteable_mongo allows you to make your Mongoid::Document or MongoMapper::Document objects voteable and tabulate votes count and votes point for you. For instance, in a forum, a user can vote up (or down) on a post or a comment. It's optimized for speed by using only ONE database request per collection to validate, update, and retrieve updated data.
Initial idea based on http://cookbook.mongodb.org/patterns/votes.
-Sample app at https://github.com/vinova/simple_qa.
-
-Wonder how fast voteable_mongo is compare to other SQL & MongoDB solutions?
-Visit benchmarks at https://github.com/vinova/voteable_benchmarks
-
== Why voteable_mongo?
There are various solutions for up / down voting problem (1[https://github.com/medihack/make_voteable], 2[https://github.com/brady8/thumbs_up], 3[https://github.com/icaruswings/mm-voteable], 4[https://github.com/jcoene/mongoid_voteable], ...). Most of them using additional votes table (SQL) or votes collection (MongoDB) to store votes and do data tabulation on that votes table or votes collection.
voteable_mongo is different. It takes advantage of document-oriented database to store all related votes data inside voteable document. That has following benefits:
@@ -27,10 +26,11 @@
== Sites using voteable_mongo
* http://www.naiku.net
* http://www.amorveneris.com
* http://zheye.org
+* http://megalyrics.ru
== Installation
=== Rails 3.x
@@ -79,45 +79,10 @@
include Mongoid::Document
include Mongo::Voter
end
-== MongoMapper
-post.rb
-
- class Post
- include MongoMapper::Document
- include Mongo::Voteable
-
- # set points for each vote
- voteable self, :up => +1, :down => -1
-
- many :comments
- end
-
-comment.rb
-
- require 'post'
-
- class Comment
- include MongoMapper::Document
- include Mongo::Voteable
-
- belongs_to :post
-
- voteable self, :up => +1, :down => -3
- voteable Post, :up => +2, :down => -1
- end
-
-user.rb
-
- class User
- include MongoMapper::Document
- include Mongo::Voter
- end
-
-
=== Make a vote
@user.vote(@post, :up)
Is equivalent to
@@ -203,10 +168,10 @@
Ruby
Mongo::Voteable::Tasks.migrate_old_votes
== Credits
* Alex Nguyen - Author
-* Contributors[https://github.com/vinova/voteable_mongo/contributors]
+* Contributors[https://github.com/rs-pro/voteable_mongo/contributors]
Copyright (c) 2010-2011 Vinova Pte Ltd
Licensed under the MIT license.