Questions tagged [acts-as-votable]

Acts As Votable is a Ruby on Rails gem that provides voting for models.

Acts As Votable is a Ruby Gem specifically written for Rails/ActiveRecord models. The main goals of this gem are:

  • Allow any model to be voted on, like/dislike, upvote/downvote, etc.
  • Allow any model to be voted under arbitrary scopes.
  • Allow any model to vote. In other words, votes do not have to come from a user, they can come from any model (such as a Group or Team).
  • Provide an easy to write/read syntax.

Link To Gem

80 questions
0
votes
1 answer

Delete unnecessary fields from acts_as_votable gem migration

Rails acts_as_votable gem generates current set of fields: :cached_votes_score :cached_votes_total :cached_weighted_total :cached_weighted_average :cached_votes_up :cached_votes_down :cached_weighted_score Which fields can be deleted so…
0
votes
1 answer

acts_as_votable No Routes Matching Error Rails 5

I am trying to add the acts_as_votable to like post comments on my rails 5 app. The gem was installed fine, I added two migrations (ActsAsVotable and AddCachedLikesToVotes) and to my CommentsController I added: def like @post =…
DianaBG
  • 1,511
  • 3
  • 10
  • 13
0
votes
2 answers

Rails AJAX respond_to not getting JavaScript back

I'm trying to implement an AJAX Acts_As_Votable update as discussed in a few other discussions, but for some reason, the format.js doesn't seem to be firing when I send the AJAX request to update the vote count. What should happen is that the image…
Nat
  • 337
  • 2
  • 13
0
votes
1 answer

Sorting posts based on the most liked in Rails

I am trying to have two tabs, one for the most recent posts and the other is for the most liked posts. However, I am really stuck of how to get my post sorted by the most liked(voted). I did use acts_as_votable gem to get the voting system part into…
hekmat
  • 93
  • 2
  • 8
0
votes
1 answer

Acts_As_Votable can't vote on other user's posts

I am using the acts_as_votable gem and am having an issue with the voting. I have two models - User and Post. A User is able to vote on a post. The problem I am having is that the User is only currently able to vote on their own post, but not other…
user6806935
0
votes
1 answer

Rails - ajax not responding when respond_to wrapped in if statement

Background: I'm using the acts_as_votable gem to log likes on a Resource model. I am working on splitting the behavior of the like button to accommodate (a) users who are signed in and (b) users who are not signed in. before/after actions in the…
rcrusoe
  • 441
  • 2
  • 4
  • 14
0
votes
1 answer

NoMethodError in PostsController#upvote undefined method `upvote_by' for nil:NilClass

screenshot Currently I'm using acts_as_votable gem along with bootstrp-sass gem,I want to upvote the post when glyphicon icon is clicked, instead it throws me above errors. This is my posts_controller.rb file class PostsController <…
Bikal
  • 33
  • 9
0
votes
1 answer

How to destroy all votes for a model using acts_as_votable in Ruby on Rails

I have implemented like and dislike functions for my posts already and they work just fine. In this phase I'm trying to provide some admin powers and privileges for my app. One of them is having the admin being able to reset votes for a post. A…
Armin
  • 1
  • 2
0
votes
1 answer

Trying to add karma to acts_as_votable

Im trying to add karma to acts_as_votable. Lost! Please help. Basically I have a up/down vote working on the Articles. I would like to add 1 to publishers karma each time their article is upvoted. (and subtract 1 when one is downvoted). So in a…
Yesthe Cia
  • 528
  • 1
  • 7
  • 20
0
votes
1 answer

Using the Acts_as_votable gem with Angularjs

Basically I want to access Acts_as_Votable through an Angular template. I have a list of cars that people can vote on. However, I can't display the votes when the list is rendered in Angular. I'm guessing I need to pass some sort of association for…
0
votes
1 answer

How to get posts with votes between two numbers? - Rails

I tried this, but it didn't work, it returns all posts Post.where(' -1 < cached_votes_score < 10') although Post.where(' cached_votes_score < 10') works, any thoughts on this?
0
votes
1 answer

How to get posts with votes above a certain number? - Rails

I'm trying to make a feed page where users can see the popular posts and the posts of whom they followed. This what I tried (but failed): @popularPosts = Post.where(cached_votes_score > '2') returning an error. undefined local variable or method…
Malek Zalfana
  • 318
  • 2
  • 11
0
votes
1 answer

Devise and acts_as_votable: where votes_for voter_id => current_user.id

I'm using the devise and acts_as_votable gems to allow users to cast their votes on posts. My current objective is to query a list of the posts liked by the user. Looking around in the Rails console I found out that when a post is voted on a…
JackHasaKeyboard
  • 1,599
  • 1
  • 16
  • 29
0
votes
2 answers

Ruby on Rails acts_as_votable gem

I am trying to create a voting system using acts_as_votable gem in Rails 4. I have three nominees to be voted from and I want a voter to choose from any of those three and vote only one nominee.acts_as_votable gem allows voter to vote multiple…
0
votes
0 answers

cached votes not updating with validates_presence_of in model

I have acts_as_taggable installed and working for my products with cached votes. After I tried to finish my validations inside the Product model with validates_presence_of the cached votes are not getting updated anymore. Anyone had the same…
Freebian
  • 107
  • 11