In my app i am using act_as_votable to vote my products, it works fine on localhost but on heroku am getting:
RoutingError (No route matches [GET] "/products/1/like"):
My routes
resources :products do
member do
put "like" =>"products#upvote"
end
resources :previews, except: [:show, :index]
end
Products Controller
def upvote
@product = Product.find(params[:id])
@product.upvote_from current_user
redirect_to @product
end
in my product show page
<%= link_to like_product_path(@product), method: :put do %>
Add to Wishlist
<% end %>
i thought it was happening because of jquery so i have added jquery in the show page but the issue remained the same. any help will be appreciated.
Your best bet would be to use a button_to
instead, it will produce a POST
request by default.
<%= button_to 'Add to Wishlist', like_product_path(@product), method: :put %>