https://github.com/r0man/acts_as_voteable
Fork of Juixe Software's acts_as_voteable plugin.
https://github.com/r0man/acts_as_voteable
Last synced: 8 months ago
JSON representation
Fork of Juixe Software's acts_as_voteable plugin.
- Host: GitHub
- URL: https://github.com/r0man/acts_as_voteable
- Owner: r0man
- License: mit
- Created: 2009-03-07T16:52:55.000Z (almost 17 years ago)
- Default Branch: master
- Last Pushed: 2009-03-09T09:57:34.000Z (almost 17 years ago)
- Last Synced: 2025-04-01T16:05:06.555Z (9 months ago)
- Language: Ruby
- Homepage: http://www.juixe.com/techknow/index.php/2006/06/24/acts-as-voteable-rails-plugin
- Size: 86.9 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: MIT-LICENSE
Awesome Lists containing this project
README
Acts As Voteable
================
This plugin allows voting 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_voteable.git
Usage
-----
Create a migration:
./script/generate acts_as_voteable
Make your model voteable:
class Article < ActiveRecord::Base
acts_as_voteable
end
article = Article.create(:text => "Lorem ipsum dolor sit amet.")
alice, bob = User.create(:name => "alice"), User.create(:name => "bob")
article.vote(true, alice)
article.number_of_votes_for # => 1
article.vote(false, bob)
article.number_of_votes_against # => 1
Look at the tests to see more examples...
Credits
-------
Originally written by Juixe Software.
-
---
Copyright (c) 2009 Roman Scherer, released under the MIT license