I am trying to use the vote_fu gem and I encounter a problem that other have as well, but I can't solve this with others' solutions..
I don't think the problem is related directly to the gem.. but rather to some wrong route or a missing parameter..
I have a Msg model which I included the act_as_voteable
.
For the User Model I added act_as_voter
In the Msg controller I added
def votefor
@msg= Msg.find(params[:id])
current_user.vote_for(@msg)
redirect_to :back
end
In routes:
resources :msgs do
member do
post :votefor
end
end
And to the show of Msg I added
<%= link_to "Vote Up", votefor_msg_path(@msg), :method => :post %>
But when I click on the link created I get
Routing Error
No route matches [GET] "/msgs/1/votefor"
Why does it 'GET' instead of 'POST'? What am I missing?