The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

27 lines
657 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: account_pins
  5. #
  6. # id :bigint(8) not null, primary key
  7. # account_id :bigint(8)
  8. # target_account_id :bigint(8)
  9. # created_at :datetime not null
  10. # updated_at :datetime not null
  11. #
  12. class AccountPin < ApplicationRecord
  13. include RelationshipCacheable
  14. belongs_to :account
  15. belongs_to :target_account, class_name: 'Account'
  16. validate :validate_follow_relationship
  17. private
  18. def validate_follow_relationship
  19. errors.add(:base, I18n.t('accounts.pin_errors.following')) unless account.following?(target_account)
  20. end
  21. end