I have acts_as_votable configured like so to generate upvoting and downvoting of content in my app:
partial:
<div class="btn-group">
<%= link_to like_link_path(link), method: :put, class: "btn btn-success btn-sm" do %>
<span class="glyphicon glyphicon-chevron-up"></span>
Upvote
<%= link.get_upvotes.size %>
<% end %>
<%= link_to dislike_link_path(link), method: :put, class: "btn btn-warning btn-sm" do %>
<span class="glyphicon glyphicon-chevron-down">
Downvote
<%= link.get_downvotes.size %>
<% end %>
</div>
Controller:
def upvote
@link = Link.find(params[:id])
@link.upvote_by current_user
redirect_to :back
end
def downvote
@link = Link.find(params[:id])
@link.downvote_from current_user
redirect_to :back
end
routes:
resources :links do
member do
put "like", to: "links#upvote"
put "dislike", to: "links#downvote"
end
end
Although I illicitly call for a put request in both my routes and view, my logs show that my browser is trying to make a get request:
Jan 12 16:43:24 quotesappp app/web.1: Started GET "/links/1/dislike" for 96.248.110.224 at 2016-01-13 00:43:23 +0000
This was not an issue previously when I was testing locally, but on deployment to Heroku, it is not registering a put request. Can anyone see what I am doing wrong?