Skip to content

Commit

Permalink
README: Update API calls for votes, likes, etc. (#197)
Browse files Browse the repository at this point in the history
The API has changed for retrieving votes, likes, dislikes, positives,
negatives, etc, particularly in 0.8.0.

Update the API examples from #votes to #votes_for and the like.
  • Loading branch information
ybakos authored Dec 19, 2020
1 parent 18ded6f commit 4f09674
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ end

@user.likes @article

@article.votes.size # => 1
@article.likes.size # => 1
@article.dislikes.size # => 0
@article.votes_for.size # => 1
@article.get_likes.size # => 1
@article.get_dislikes.size # => 0
```

To check if a voter has voted on a model, you can use ``voted_for?``. You can
Expand Down Expand Up @@ -273,8 +273,8 @@ because `@user` has already voted for `@shoe`.
@user.likes @shoe
@user.likes @shoe

@shoe.votes # => 1
@shoe.likes # => 1
@shoe.votes_for.size # => 1
@shoe.get_likes.size # => 1
```

To check if a vote counted, or registered, use `vote_registered?` on your model
Expand All @@ -290,9 +290,9 @@ after voting. For example:
@hat.disliked_by @user
@hat.vote_registered? # => true, because user changed their vote

@hat.votes.size # => 1
@hat.positives.size # => 0
@hat.negatives.size # => 1
@hat.votes_for.size # => 1
@hat.get_positives.size # => 0
@hat.get_negatives.size # => 1
```

To permit duplicates entries of a same voter, use option duplicate. Also notice that this
Expand Down

0 comments on commit 4f09674

Please sign in to comment.