gabrielg / acts_as_rateable forked from azabaj/acts_as_rateable

Acts_as_rateable is a Ruby on Rails plugin which makes ActiveRecord models rateable through a polymorphic association and optionally logs which user rated which object. This plugin is used in production.

This URL has Read+Write access

Gabriel Gironda (author)
Sun Sep 14 20:59:23 -0700 2008
commit  7c752bb7d7528ca32d0ec934e733954d0641a618
tree    d881feb638f59e956df509ab30615f11c0f56a6c
parent  8f3c0dbc258aa1dfe7df516ec08f99d5da04e817
name age message
file MIT-LICENSE Thu May 29 03:23:13 -0700 2008 * Added all plugin files. [azabaj]
file README Mon Jun 23 01:22:41 -0700 2008 Small typo fix in README [azabaj]
file Rakefile Thu May 29 03:23:13 -0700 2008 * Added all plugin files. [azabaj]
directory generators/ Loading commit data...
file init.rb Thu May 29 03:23:13 -0700 2008 * Added all plugin files. [azabaj]
directory lib/
directory tasks/ Thu May 29 03:23:13 -0700 2008 * Added all plugin files. [azabaj]
directory test/ Thu May 29 03:23:13 -0700 2008 * Added all plugin files. [azabaj]
README
Acts As Rateble
=============

Acts_as_rateable is a plugin released under the MIT license. 
It makes activerecord models rateable through a polymorphic association and optionally logs which user rated which 
model.
In this case, one user can rate an object once. Used on cotcot.hu for article rating, sponsored quizzes, etc.


Example
=======

Install the plugin into your vendor/plugins directory, insert 'acts_as_rateable' into your model, then restart your 
application.

class Post < ActiveRecord::Base

  acts_as_rateable
  
end

Now your model is extended by the plugin, you can rate it ( 1-# )or calculate the average rating.

@post.rate_it( 4, current_user.id )

@post.average_rating #=> 4.0

@post.average_rating_round #=> 4

@post.average_rating_percent #=> 80

@post.rated_by?( current_user ) #=> rating || false

Post.find_average_of( 4 ) #=> array of posts

See acts_as_rateable.rb for further details!

Copyright (c) 2007 Ferenc Fekete, http://xpnindustries.com , released under the MIT license