implement super voters

This commit is contained in:
r888888888
2016-02-22 14:02:52 -08:00
parent caf4a28b02
commit 2a87aad34e
13 changed files with 189 additions and 12 deletions

View File

@@ -7,6 +7,10 @@ class PostVote < ActiveRecord::Base
validates_inclusion_of :score, :in => [1, -1]
attr_accessible :post_id, :user_id, :score
def self.prune!
where("created_at < ?", 30.days.ago).delete_all
end
def score=(x)
if x == "up"
write_attribute(:score, 1)