about summary refs log tree commit diff stats
path: root/app/models/comment.rb
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-14 11:12:05 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-14 11:12:05 -0400
commitfce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd (patch)
tree27d42a442c000781d100dfa7fd8b976aefb03c31 /app/models/comment.rb
parent0aace2986a9a7a6d4c84a9ba6819d3df7821e267 (diff)
downloadthoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.tar.gz
thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.tar.bz2
thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.zip
Added comment replying
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