added validation to comment

This commit is contained in:
nilsding 2014-12-07 14:29:47 +01:00
parent 8479f308ac
commit 2d44eeef60
1 changed files with 2 additions and 0 deletions

View File

@ -3,4 +3,6 @@ class Comment < ActiveRecord::Base
belongs_to :answer
validates :user_id, presence: true
validates :answer_id, presence: true
validates :content, length: { maximum: 160 }
end