diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-14 11:12:05 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-14 11:12:05 -0400 |
commit | fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd (patch) | |
tree | 27d42a442c000781d100dfa7fd8b976aefb03c31 /app/models | |
parent | 0aace2986a9a7a6d4c84a9ba6819d3df7821e267 (diff) | |
download | thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.tar.gz thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.tar.bz2 thoughts-fce622b5b1959892b6f6ea94bfe3a1c4eb52d8dd.zip |
Added comment replying
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/comment.rb | 3 |
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 |