This commit is contained in:
r888888888
2014-04-14 14:32:01 -07:00
parent 7a61048d69
commit fad0ab7c93
105 changed files with 610 additions and 485 deletions

View File

@@ -9,13 +9,14 @@ class CommentVote < ActiveRecord::Base
validate :validate_user_can_vote
validate :validate_comment_can_be_down_voted
validates_inclusion_of :score, :in => [-1, 1], :message => "must be 1 or -1"
attr_accessible :comment_id, :user_id, :score
def self.prune!
destroy_all("created_at < ?", 14.days.ago)
end
def self.search(params)
q = scoped
q = where("true")
return q if params.blank?
if params[:comment_id]