emrhnksck
emrhnksck

Reputation: 41

Http request work differently from the parameter I gave in Ruby on Rails

I have article model and i want to give it votable ability with acts_as_votable gem.I have like_article route for like article and its PUT method and i have that route in my file

<%= link_to like_article_path(article), method: :put do %>
  Like
  <%= article.get_upvotes.size %>
<% end %>

if i hit the like button i'm getting No route matches [GET] "/articles/11/like" error it act like get method but i gave method: :put parameter it should be put why it dowsnt see my parameter how can i fix that?

Upvotes: 0

Views: 40

Answers (1)

emrhnksck
emrhnksck

Reputation: 41

I dont know why but i used button_to instead of link_to it worked.

Upvotes: 2

Related Questions