The code powering m.abunchtell.com https://m.abunchtell.com
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 

34 рядки
813 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: follow_requests
  5. #
  6. # id :integer not null, primary key
  7. # account_id :integer not null
  8. # target_account_id :integer not null
  9. # created_at :datetime not null
  10. # updated_at :datetime not null
  11. #
  12. class FollowRequest < ApplicationRecord
  13. include Paginable
  14. belongs_to :account, required: true
  15. belongs_to :target_account, class_name: 'Account', required: true
  16. has_one :notification, as: :activity, dependent: :destroy
  17. validates :account_id, uniqueness: { scope: :target_account_id }
  18. def authorize!
  19. account.follow!(target_account)
  20. MergeWorker.perform_async(target_account.id, account.id)
  21. destroy!
  22. end
  23. def reject!
  24. destroy!
  25. end
  26. end