Agile Web Development

Build it. Launch it. Love it.

acts_as_rated

The ultimate rating system for ActiveRecord models. Highly flexible and configurable, while easy to use with the defaults. Supports 3 different ways to manage the statistics, and creates all the needed associations for easy access to everything.

Comes complete with the needed migrations code to make it easy to add to any project.

NOTE: It uses some advanced SQL constructs that might not be supported by all servers. It was tested on Postgres only. If you have patches/fixes for other databases, please send them and I will add them to the plugin.

Features

  • Rate any model
  • Optionally add fields to the rated objects to optimize speed
  • Optionally add an external rating statistics table with a record for each rated model
  • Can work with the added fields, external table or just using direct SQL count/avg calls
  • Use any model as the rater (defaults to User)
  • Limit the range of the ratings
  • Average, total and number of ratings
  • Find objects by ratings or rating ranges
  • Find objects by rater
  • Extensively tested

Vitals

Home http://acts-as-rated.rubyforge.org
Repository svn://rubyforge.org/var/svn/acts-as-rated/trunk/acts_as_rated
License Rails' (MIT)
Rating (255 votes)
Owner Guy Naor
Created 5 February 2007

Comments

  • Avatar
    Michael
    4 June 2008

    Great Plugin.

    To get decimal numbers for the rating_avg instead of integers you have to change the following lines (216 and 225)

    Remove: target.ratingavg = target.ratingtotal / target.rating_count

    Insert: target.ratingavg = target.ratingtotal target.ratingavg /= target.ratingcount

  • Gerto
    21 September 2008

    Works great, thanks!

Add a comment