闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
412 B

  1. # frozen_string_literal: true
  2. class Follow < ApplicationRecord
  3. include Paginable
  4. belongs_to :account, counter_cache: :following_count
  5. belongs_to :target_account, class_name: 'Account', counter_cache: :followers_count
  6. has_one :notification, as: :activity, dependent: :destroy
  7. validates :account, :target_account, presence: true
  8. validates :account_id, uniqueness: { scope: :target_account_id }
  9. end