fixes #69: Comment voting non functional

This commit is contained in:
albert
2011-09-14 17:46:42 -04:00
parent fcc6a78fd4
commit 22074eed1f
10 changed files with 73 additions and 31 deletions

View File

@@ -5,7 +5,7 @@ class CommentVote < ActiveRecord::Base
belongs_to :user
before_validation :initialize_user, :on => :create
validates_presence_of :user_id, :comment_id, :score
validates_uniqueness_of :user_id, :scope => :comment_id
validates_uniqueness_of :user_id, :scope => :comment_id, :message => "has already voted for this comment"
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"