From 44cea600212651cfb9f5022837c6d53af51f16bc Mon Sep 17 00:00:00 2001 From: nilsding Date: Sun, 30 Nov 2014 19:43:03 +0100 Subject: [PATCH] added validation for Comment model --- app/models/comment.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/comment.rb b/app/models/comment.rb index ef5cd49c..51ce7d91 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -1,4 +1,6 @@ class Comment < ActiveRecord::Base belongs_to :user belongs_to :answer + validates :user_id, presence: true + validates :answer_id, presence: true end