Acts As Rated plugin

Plugin details

Rating system for ActiveRecord models. Efficient SQL, configurable options and ready to run migrations. Extensive test suite is included.

Websitehttp://acts-as-rated.rubyforge.org/ Repositorysvn://rubyforge.org/var/svn/acts-as-rated/trunk/acts_as_rated Author Guy Naor Tags rating LicenseRuby's (MIT)

Documentation

Install the plugin:
ruby script/plugin install svn://rubyforge.org/var/svn/acts-as-rated/trunk/acts_as_rated

Simple rating system
==================
Look at the file test/rating_test.rb for many usage examples covering all variations of the plugin.

  class Book < ActiveRecord::Base
    acts_as_rated
  end

  bill = User.find_by_name 'bill'
  jill = User.find_by_name 'jill'
  catch22 = Book.find_by_title 'Catch 22'
  hobbit  = Book.find_by_title 'Hobbit'

  catch22.rate 5, bill
  hobbit.rate  3, bill
  catch22.rate 1, jill
  hobbit.rate  5, jill

  hobbit.rating_average # => 4
  hobbit.rated_total    # => 8
  hobbit.rated_count    # => 2

  hobbit.unrate bill 
  hobbit.rating_average # => 5
  hobbit.rated_total    # => 5
  hobbit.rated_count    # => 1

  bks = Book.find_by_rating 5     # => [hobbit]
  bks = Book.find_by_rating 1..5  # => [catch22, hobbit]

  usr = Book.find_rated_by jill   # => [catch22, hobbit]

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, about 1 year ago