Skip to content

Commit

Permalink
Mod: 回答加入每人一次的唯一验证
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Apr 5, 2011
1 parent 5f955e7 commit fef4148
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/answer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Answer < BaseModel
field :spam_voter_ids, :type => Array, :default => []

validates_presence_of :user_id, :body
validates_uniqueness_of :user_id, :scope => [:ask_id]

# 敏感词验证
before_validation :check_spam_words
def check_spam_words
Expand Down

0 comments on commit fef4148

Please sign in to comment.