Note that there are some explanatory texts on larger screens.

plurals
  1. POClarification on how to use "thumbs_up" voting gem with Rails 3
    primarykey
    data
    text
    <p>I am attempting to implement the <a href="https://github.com/bouchard/thumbs_up" rel="nofollow">thumbs_up</a> voting gem on a Rails 3 app, however the instructions are unclear on the actual implementation. After requiring the gem [<strong>gem 'thumbs_up'</strong>] and after creating and running the appropriate migration [<strong>rails generate thumbs_up &amp;&amp; rake db:migrate</strong>] the README explains the following:</p> <blockquote> <p><strong>To cast a vote for a Model you can do the following:</strong><br> *Shorthand syntax<br>voter.vote_for(voteable) # Adds a +1 vote<br>voter.vote_against(voteable) # Adds a -1 vote<br>voter.vote(voteable, vote) # Adds either a +1 or -1 vote: vote => true (+1), vote => false (-1)<br><br> voter.vote_exclusively_for(voteable) # Removes any previous votes by that particular voter, and votes for.<br> voter.vote_exclusively_against(voteable) # Removes any previous votes by that particular voter, and votes against.*</p> </blockquote> <p>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. </p> <p><strong>A literal example of what my view, controller, and routes.rb file should look like would be a TREMENDOUS help.</strong> I've spent days trying to figure this out!</p> <p>In my app, I have Users that vote on Posts - of which there are two types - <em>Events</em> and <em>Links</em>. Posts are called using <strong>&lt;%= render :partial => @posts %></strong> and each individual post uses as its view "<strong>_event.html.erb</strong>" or "<strong>_link.html.erb</strong>" - depending whether it is an event or a link.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload