mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 03:07:52 +01:00
11 lines
306 B
Ruby
11 lines
306 B
Ruby
class Comment < ApplicationRecord
|
|
belongs_to :user
|
|
belongs_to :post
|
|
belongs_to :parent, class_name: 'Comment', optional: true
|
|
has_many :children, class_name: 'Comment', foreign_key: 'parent_id', dependent: :destroy
|
|
|
|
validates :body, presence: true, length: { minimum: 4 }
|
|
|
|
paginates_per 15
|
|
end
|