|
- class Post < ApplicationRecord
- belongs_to :parent, class_name: 'Post', optional: true, foreign_key: 'parent_id'
- belongs_to :uploaded_user, class_name: 'User', optional: true
- has_many :post_tags, dependent: :destroy
- has_many :tags, through: :post_tags
- has_many :user_post_views, dependent: :destroy
- end
|