Skip to content

Commit 4f09674

Browse files
authored
README: Update API calls for votes, likes, etc. (#197)
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.
1 parent 18ded6f commit 4f09674

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ end
198198

199199
@user.likes @article
200200

201-
@article.votes.size # => 1
202-
@article.likes.size # => 1
203-
@article.dislikes.size # => 0
201+
@article.votes_for.size # => 1
202+
@article.get_likes.size # => 1
203+
@article.get_dislikes.size # => 0
204204
```
205205

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

276-
@shoe.votes # => 1
277-
@shoe.likes # => 1
276+
@shoe.votes_for.size # => 1
277+
@shoe.get_likes.size # => 1
278278
```
279279

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

293-
@hat.votes.size # => 1
294-
@hat.positives.size # => 0
295-
@hat.negatives.size # => 1
293+
@hat.votes_for.size # => 1
294+
@hat.get_positives.size # => 0
295+
@hat.get_negatives.size # => 1
296296
```
297297

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

0 commit comments

Comments
 (0)