我正在使用thumbs_up gem提供用户在我的应用中对帖子投票。我希望用户上下投票,并遵循thumbs_up wiki中的指示开始工作。使用thumbs_up计算总票数
这里是后控制我的投票后续行动: -
def vote_up
begin
current_user.vote(@post,:true)
redirect_to [@topic.forum,@topic]
flash[:success] = "You have voted successfully"
rescue ActiveRecord::RecordInvalid
redirect_to [@topic.forum,@topic]
flash[:error] = "You have already voted for this one"
end
end
当我点击vote_up链接,我得到这个错误信息: -
cannot convert symbol into an integer
路线: -
resources :topics do
resources :posts do
member do
post :vote_post_up
post :vote_post_down
end
end
end
查看: -
<li> <%=link_to "Vote Up", vote_post_up_topic_post_path(@topic,post), :method => :post%></li>
这里有什么问题?
你可以添加一些路线,这样我们就可以知道你的'vote_up'链接的样子:) – Rohit
@Rohit我已经更新了问题 –