guoren/app/models/micro_post.rb

5 lines
175 B
Ruby

class MicroPost < ApplicationRecord
belongs_to :user, dependent: :destroy
has_many :comments, class_name: 'Comment', foreign_key: 'micro_post_id', dependent: :destroy
end