about summary refs log tree commit diff stats
path: root/app/models/comment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/comment.rb')
-rw-r--r--app/models/comment.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb index 9697100..b85f3b6 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb
@@ -3,6 +3,9 @@ class Comment < ApplicationRecord
3 3
4 belongs_to :blog 4 belongs_to :blog
5 5
6 has_many :replies, class_name: "Comment", foreign_key: "reply_to_id"
7 belongs_to :reply_to, class_name: "Comment", optional: true
8
6 validates :body, presence: true 9 validates :body, presence: true
7 validates :username, presence: true 10 validates :username, presence: true
8 validates :email, presence: true, format: URI::MailTo::EMAIL_REGEXP 11 validates :email, presence: true, format: URI::MailTo::EMAIL_REGEXP