I am trying to create a voting picture system on rails 3. What I would like to have happen is have two pictures, and have people on the site vote for which one they like more. I know they have a thumbs_up gem, which creates a voting system quickly. Is there a way to either modify the gem to have it work for pictures or is there a simple way to create this?
Asked
Active
Viewed 723 times
-1
-
What is the hard part? You can show two pictures on the screen, and each picture with a link to the thumbs up vote. – user482594 Jul 05 '11 at 20:57
-
Can you try to boil this down to an atomic, non-subjective question? Is there a specific issue you are having with the `thumbs_up` gem? – colinross Jul 05 '11 at 21:23
-
I guess it would be having it analyze the clicks to show which picture is liked more. Is that involved in thumbs_up? – conpill Jul 05 '11 at 21:32
-
1What "The social network", you might find the answer with facemash. Kidding! – Dominic Goulet Jul 06 '11 at 09:18
1 Answers
0
you don't need to modify the gem. Just create an appropriate Model for your Images:
class Image < ActiveRecord::Base
acts_as_voteable
end
and for your users:
class User < ActiveRecord::Base
acts_as_voter
end
after you can compare the upvote count of 2 images with something like:
image1.votes_for > image2.votes_for

tmaximini
- 8,403
- 6
- 47
- 69