diff --git a/app/components/post_votes_component/post_votes_component.html.erb b/app/components/post_votes_component/post_votes_component.html.erb index f099b162a..89b84247d 100644 --- a/app/components/post_votes_component/post_votes_component.html.erb +++ b/app/components/post_votes_component/post_votes_component.html.erb @@ -2,7 +2,7 @@ <% if current_user.is_anonymous? %> <%= link_to upvote_icon, login_path(url: request.fullpath), class: "post-upvote-link inactive-link" %> <% elsif upvoted? %> - <%= link_to upvote_icon, post_vote_path(current_vote), class: "post-upvote-link post-unvote-link active-link", method: :delete, remote: true %> + <%= link_to upvote_icon, post_post_votes_path(post), class: "post-upvote-link post-unvote-link active-link", method: :delete, remote: true %> <% else %> <%= link_to upvote_icon, post_post_votes_path(post_id: post.id, score: 1), class: "post-upvote-link inactive-link", method: :post, remote: true %> <% end %> @@ -14,7 +14,7 @@ <% if current_user.is_anonymous? %> <%= link_to downvote_icon, login_path(url: request.fullpath), class: "post-downvote-link inactive-link" %> <% elsif downvoted? %> - <%= link_to downvote_icon, post_vote_path(current_vote), class: "post-downvote-link post-unvote-link active-link", method: :delete, remote: true %> + <%= link_to downvote_icon, post_post_votes_path(post), class: "post-downvote-link post-unvote-link active-link", method: :delete, remote: true %> <% else %> <%= link_to downvote_icon, post_post_votes_path(post_id: post.id, score: -1), class: "post-downvote-link inactive-link", method: :post, remote: true %> <% end %> diff --git a/app/controllers/post_votes_controller.rb b/app/controllers/post_votes_controller.rb index 7a6232b41..a1cd76f1d 100644 --- a/app/controllers/post_votes_controller.rb +++ b/app/controllers/post_votes_controller.rb @@ -25,7 +25,7 @@ class PostVotesController < ApplicationController def destroy if params[:post_id].present? - @post_vote = PostVote.active.find_by(post_id: params[:post_id], user_id: CurrentUser.user) + @post_vote = PostVote.active.find_by(post_id: params[:post_id], user: CurrentUser.user) @post = Post.find(params[:post_id]) else @post_vote = PostVote.find(params[:id])