dm-is-voteable

A DataMapper compatible “anonymous” voting plugin. Can track votes by IP so a user may only submit a single vote.

< Rails 3 not tested.

Installation

To install as a gem add the following line to your gem file. gem “dm-is-voteable”

Then run: $ bundle install

And build the required DB tables: $ rake db:auto_update

Example

Add:

is :voteable

To any model and gain the power of the vote method.

class Movie

include DataMapper::Resource

property :id, Serial

is :voteable

property :title, String, :required => true

end

Vote for the Model by calling: Model.vote

Allow only a single vote per user by sending the request IP with the vote:

user_ip = request.env Model.vote(user_ip)

Copyright © 2010 Brian Pearce, released under the MIT license