logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

follow.rb (829B)


  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: follows
  5. #
  6. # id :integer not null, primary key
  7. # created_at :datetime not null
  8. # updated_at :datetime not null
  9. # account_id :integer not null
  10. # target_account_id :integer not null
  11. # show_reblogs :boolean default(TRUE), not null
  12. #
  13. class Follow < ApplicationRecord
  14. include Paginable
  15. include RelationshipCacheable
  16. belongs_to :account, counter_cache: :following_count
  17. belongs_to :target_account,
  18. class_name: 'Account',
  19. counter_cache: :followers_count
  20. has_one :notification, as: :activity, dependent: :destroy
  21. validates :account_id, uniqueness: { scope: :target_account_id }
  22. scope :recent, -> { reorder(id: :desc) }
  23. end