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
3
votes
1 answer

Acts as votable - refresh likes-count on home page [Rails - AJAX]

i have a little problem with acts as votable. My likes button and the count is refreshed correctly (with AJAX) on the page of each of my "softwares". But does not work properly on the home page (or there are several softwares). When I click on a…
Clyde T
  • 141
  • 10
2
votes
2 answers

How to Write link_to for acts_as_votable nested resources?

I am trying to add voting to my site. I have improvements that are created and displayed inside of the projects show page. I'm trying to allow users to vote on improvements but I am getting an error that I think is related to how I'm linking the…
2
votes
2 answers

Ajax for post upvote/downvote (stopping page refresh)

I'm using "acts_as_votable" gem in my Rails application so that Users can vote on Posts. I'm trying to add Ajax functionality so that the entire page doesn't have to refresh when a user upvotes a post. My upvote/downvote links are clickable and…
naridi
  • 77
  • 2
  • 8
2
votes
2 answers

How to show all my posts liked by user

I'm trying to show all the posts that I like by current user. I'm using Ruby on Rails, and the gems Devise and "Acts As Votable". I've been following the Acts As Votable guide but can't make it work. I think this is the way to go: @post.liked_by…
2
votes
0 answers

Vote using IP Address and Acts As Votable Gem

I want to be able to vote on my links without having to login through something like devise or other authentication system. I have devised installed on my application and it's up and running and works fine. But I don't want the user to have to be…
2
votes
2 answers

Rails 4 ajax acts as votable with turbo links vote counts not updating

I'm able to click on the link once, and the count will update, but it doesn't update on the clicks after that, nor does it update into the database (looking at the console). index.html.haml .votes - if current_user.liked? skit = link_to…
hellomello
  • 8,219
  • 39
  • 151
  • 297
2
votes
2 answers

No route matches [GET] "/links/1/like" acts_as_votable

The other solutions here did not work, so I am posting a new question. I am using acts_as_votable for up and down voting on links, but when I try to actually vote I get the error: No route matches [GET] "/links/1/like" This is what my view looks…
Jbur43
  • 1,284
  • 17
  • 38
2
votes
1 answer

Rails Acts_as_votable ajax/js upvoting all posts instead of one

Okay, I'm starting to pull my hair out on this one. I'm new to rails, and was following a tutorial on making a pinterest style app. I finished it but wasn't happy with the up-voting system. It was refreshing the page every time I clicked to up vote.…
tdog
  • 147
  • 2
  • 10
1
vote
1 answer

getting most liked posts by users using act as votable gem rails

I want to display the top 10 users whose posts got the most likes in past 2 hours, how can I do that inquest index to get user <%@users.each do |user| %> <%if user.id != current_user %> <%=user.email%> <%end%> <%end%> inquest.controller…
1
vote
0 answers

Trying to return most popular blog post using acts_as_votable

So here's my model: home_blog.rb def self.highest_voted self.order("cached_votes_score DESC") end schema.rb create_table "home_blogs", force: :cascade do |t| t.string "name" t.text "entry" t.datetime "created_at", null: false …
dmberko11
  • 427
  • 7
  • 17
1
vote
2 answers

Like/Unlike using acts_as_votable gem and ajax for nested resources on Rails

I realise that there are several similar questions, but none of them seem to address the issue with nested resources. I'm quite new to ROR and I am trying to implement a like/unlike using ajax with the acts_as_votable gem. I kind of understand how…
sofarsophie
  • 239
  • 4
  • 20
1
vote
0 answers

Method for destroying activity

I am using the acts_as_votable and public_activity gems, and want to remove activities when posts are 'unliked'. The public_activity docs specify using dependent: :destroy... however, there is no model for 'likes', and so there is nothing to…
1
vote
0 answers

Rails vote after authenticating user

I'm using the acts-as-votable gem to allow users to vote on items. If a user is not signed in, the upvote button sends the user to sign in via Twitter, but the vote is not recorded. I would like to allow a user to sign in and submit a vote with the…
rcrusoe
  • 441
  • 2
  • 4
  • 14
1
vote
0 answers

Most liked posts in last 2 hours with acts_as_votable gem?

How do I do it? It's sort of like currently trending posts i.e. the posts don't necessarily have to be created in the last 2 hours. scope :top, ->{ order(:cached_votes_total => :desc) } scope :trending, ?
Arif
  • 712
  • 11
  • 20
1
vote
1 answer

Upvote button that can be unupvoted in Rails 4

I am creating a Rails 4 app in which a user can upvote a given post through the acts_as_votable gem. Let's say as a user I press the upvote button, how would I make it so that if I press the SAME button again, the vote gets taken away, so in essence…
1
2 3 4 5 6