I'm trying to use acts as votable gem and can't understand how it actually works. I couldn't find any good workarounds or tutorials for it. I tried implementing the accepted solution mentioned here but got Routing Error. Can anyone help me out with a good tutorial or point me out how to get it to work editing the following code.
routes.rb
resources :posts do
member do
put "like", to: "posts#upvote"
end
end
posts controller
def upvote
@post = Post.find(params[:id])
@post.liked_by current_user
redirect_to @post
end
show.html.erb
<%= link_to "Bookmark Post", like_post_path(@post, method: :put), class: "button tiny" %>