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

28 рядки
677 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 Paginable
  14. include RelationshipCacheable
  15. belongs_to :account
  16. belongs_to :target_account, class_name: 'Account'
  17. validate :validate_follow_relationship
  18. private
  19. def validate_follow_relationship
  20. errors.add(:base, I18n.t('accounts.pin_errors.following')) unless account.following?(target_account)
  21. end
  22. end