Devendra174's picture
Upload folder using huggingface_hub
f5071ca verified
raw
history blame contribute delete
432 Bytes
class Comment < ApplicationRecord
validates :author_id, :post_id, :body, presence: true
belongs_to :author,
foreign_key: :author_id,
class_name: :User
belongs_to :post,
foreign_key: :post_id,
class_name: :Post
belongs_to :parent_comment,
foreign_key: :parent_id,
class_name: :Comment,
optional: true
has_many :child_comments,
foreign_key: :parent_id,
class_name: :Comment
end