KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am attempting to implement the thumbs_up voting gem on a Rails 3 app, however the instructions are unclear on the actual implementation. After requiring the gem [ gem 'thumbs_up' ] and after creating and running the appropriate migration [ rails generate thumbs_up && rake db:migrate ] the README explains the following: To cast a vote for a Model you can do the following: *Shorthand syntax voter.vote_for(voteable) # Adds a +1 vote voter.vote_against(voteable) # Adds a -1 vote voter.vote(voteable, vote) # Adds either a +1 or -1 vote: vote => true (+1), vote => false (-1) voter.vote_exclusively_for(voteable) # Removes any previous votes by that particular voter, and votes for. voter.vote_exclusively_against(voteable) # Removes any previous votes by that particular voter, and votes against.* I've been assuming that the use of 'voter' and 'voteable' in the README example are stand-ins for objects in the app, but the usage is still nebulous to me. A literal example of what my view, controller, and routes.rb file should look like would be a TREMENDOUS help. I've spent days trying to figure this out! In my app, I have Users that vote on Posts - of which there are two types - Events and Links . Posts are called using <%= render :partial => @posts %> and each individual post uses as its view " _event.html.erb " or " _link.html.erb " - depending whether it is an event or a link.
Tags (comma-separated)
Save Edits
Cancel