class Post < ApplicationRecord belongs_to :parent, class_name: 'Post', optional: true, foreign_key: 'parent_id' belongs_to :user, foreign_key: '' end