This commit is contained in:
r888888888
2013-06-10 18:12:57 -07:00
parent df7bbcd4d1
commit 61f8c38d34
2 changed files with 4 additions and 0 deletions

View File

@@ -639,8 +639,10 @@ class Post < ActiveRecord::Base
if can_be_voted_by?(CurrentUser.user)
if score == "up"
Post.update_all("score = score + 1, up_score = up_score + 1", {:id => id})
self.score += 1
elsif score == "down"
Post.update_all("score = score - 1, down_score = down_score - 1", {:id => id})
self.score -= 1
end
votes.create(:score => score)