public
Rubygem
Description: Demonstrates a reference implementation for handling ratings
Homepage: http://www.pluginaweek.org
Clone URL: git://github.com/pluginaweek/has_ratings.git
name age message
file .gitignore Fri Jul 04 15:49:34 -0700 2008 Ignore test/app_root/script [obrie]
file CHANGELOG.rdoc Thu Apr 30 19:38:05 -0700 2009 Tag 0.3.0 release [obrie]
file LICENSE Loading commit data...
file README.rdoc
file Rakefile Tue Jun 09 20:32:59 -0700 2009 Add gemspec [obrie]
directory app/ Mon Apr 27 18:07:23 -0700 2009 Add dependency on Rails 2.3 Replace acts_as_enu... [obrie]
directory assets/
directory db/
file has_ratings.gemspec
file init.rb
directory lib/
directory test/

has_ratings

has_ratings demonstrates a reference implementation for handling ratings.

Resources

API

Bugs

Development

Source

  • git://github.com/pluginaweek/has_ratings.git

Description

Storing ratings is a pretty common task when building web applications with a community-based focus. Ratings can have names and values associated with them. This plugin demonstrate a simple way to manage what ratings can be used and how they are persisted.

Usage

Note that this is a reference implementation and, most likely, should be modified for your own usage.

Example

  user = User.find(1)
  video = Video.find(1)

  video.ratings.create(:rater => user, :value => 'poor')
  video.ratings.average   # => 1.0

Assets

Included with the plugin are image/stylesheet assets for creating raters using css as described at www.komodomedia.com/blog/2007/01/css-star-rating-redux

Testing

Before you can run any tests, the following gem must be installed:

To run against a specific version of Rails:

  rake test RAILS_FRAMEWORK_ROOT=/path/to/rails

Dependencies