https://github.com/r0man/acts_as_rateable
Fork of Juixe Software's acts_as_rateable plugin.
https://github.com/r0man/acts_as_rateable
Last synced: 9 months ago
JSON representation
Fork of Juixe Software's acts_as_rateable plugin.
- Host: GitHub
- URL: https://github.com/r0man/acts_as_rateable
- Owner: r0man
- License: mit
- Created: 2009-03-07T16:47:45.000Z (almost 17 years ago)
- Default Branch: master
- Last Pushed: 2009-03-22T22:41:45.000Z (almost 17 years ago)
- Last Synced: 2025-03-23T20:43:37.290Z (10 months ago)
- Language: Ruby
- Homepage: http://www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin
- Size: 94.7 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: MIT-LICENSE
Awesome Lists containing this project
README
Acts As Rateable
================
This plugin allows rating on models. It's a fork from the original
plugin developed by Juixe Software to work with newer versions of
Rails. The API has changed slightly. See the credits section for a
link to the original code.
Installation
------------
Install the plugin:
./script/plugin install git://github.com/r0man/acts_as_rateable.git
Usage
-----
Create a migration:
./script/generate acts_as_rateable
Make your model rateable:
class Article < ActiveRecord::Base
acts_as_rateable :range => (1..5)
end
article = Article.create(:text => "Lorem ipsum dolor sit amet.")
alice, bob = User.create(:name => "alice"), User.create(:name => "bob")
article.rate(1, alice)
article.rating # => 1
article.rate(2, bob)
article.rating # => 1 (cached)
article.rating(:force_reload => true) # => 1.5
Look at the tests to see more examples...
Credits
-------
Originally written by Juixe Software.
-
---
Copyright (c) 2009 Roman Scherer, released under the MIT license