views:

430

answers:

3

I'm getting started building a site with Rails and I would like people to be able to vote certain things with the options of "yes" or "no" or "right" or "wrong". I would also like there to be a running tally computed by percent (maybe below). Could someone tell me how I can add this functionality?

Thanks

+1  A: 

Remember to build it in such a way that enforces: "one vote for one IP address". Other than that, it is straight forward and plain Mathematics.

Alan Haggai Alavi
+1  A: 

I just finished up something similar.

If you'd like to see how other people have tackled this problem, just search github. There are 30 ruby repos.

I found acts_as_voteable the most helpful.

chap
+1  A: 

You should also take a look at 'counters' in the API, such that each vote has a value and the tallies are kept on the voted-on object (so it doesn't have to run a count every single time).

Sai Emrys