I followed the steps indicated in this answer for setting up thumbs_up
https://stackoverflow.com/a/4963297/1643048
However I keep getting this error and have no idea how to fix it:
No route matches {:action=>"vote_up", :controller=>"posts", :id=>nil}
Can anyone help?
UPDATE:
exact error-
Routing Error
No route matches {:action=>"vote_up", :controller=>"posts", :id=>nil}
Try running rake routes for more information on available routes.
config/routes.rb:
Projectmadrone::Application.routes.draw do
devise_for :admins
#devise_for :users
devise_for :users do get '/users/sign_out' => 'devise/sessions#destroy' end
resources :posts do
member do
post :vote_up
end
end
root :to => 'posts#index'
end
my view: app/views/posts/index.html.erb
<li><%= link_to('vote for this post!', vote_up_post_path(@post), :method => :post) %></li>