I am attempting to implement the thumbs_up voting gem on a Rails 3 app, however the instructions are unclear on the actual implementation. After requiring the gem [g
This is just a continuation of Brady's answer.
Brady had the following code in his view
<%= link_to('vote for this post!', vote_up_post_path(@post), :method => :post) %>
what he means is.. since link_to by default uses :method => 'get' & he wanted to update the record using post & not get so he is using :method => 'post'
U can use <%= button_to('vote for this post!', vote_up_post_path(@post) %>, because button by default uses :method => :post
so the routes should be
resources :posts do
member do
post :vote_up
end
end
here in post :vote_up inside the member, its the method => :post & not the post controller
but if you are determined to use link_to without :method => :post something like this
<%= link_to('vote for this post!', vote_up_post_path(@post)) %>
then your routing should be
resources :posts do
member do
get :vote_up
end
end
Hope this helps!