Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

spk/spleen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ratings for Rails 3

gem 'spleen'

bundle exec rails generate spleen:install

Usage:

# edit app/models/article.rb:
  extend Spleen
  spleen(:dependent => :destroy)

# add Article to RATEABLE_TYPES on app/models/rating.rb:
  RATEABLE_TYPES = %w{Article}

a = Article.create(:title => 'test')
a.rate(1, User.last)
a.ratings # => [#<Rating id: 1, ...]
a.average_rate # => 1.0
a.sum_rate # => 1
a.count_rate # => 1

Tests

bundle exec ruby test/*_test.rb

TODO

  • tests
  • documentation

LICENSE

The MIT License

Copyright (c) 2011 Laurent Arnoud laurent@spkdev.net

About

Ratings solution for Rails

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages