Tag: 投票

JQuery + thumbs_up gem渲染投票数?

插件: Thumbs Up和JQuery 1.5.2(另一个老gem需要) 当用户在post上投票时,我正在尝试使用完整的HTTP请求呈现更新的投票计数。 目前,它会在每次投票时刷新页面。 post控制器 def vote_up post = Post.find(params[:id]) current_user.vote_exclusively_for(post) respond_to do |format| format.js format.html {rRedirect_to :back} end end def vote_down post = Post.find(params[:id]) current_user.vote_exclusively_against(post) respond_to do |format| format.js format.html {redirect_to :back} end end 投票视图(每个postdiv在左边有一个投票div(digg / reddit样式)和右边的内容) :post, :format => :js %> all the post content, timestamp stuff, etc… vote_up.erb.js(在post文件夹中)。 $(“.votecount”).html( “”); […]