1
0

follow_recommendation_mute.rb 734 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: follow_recommendation_mutes
  5. #
  6. # id :bigint(8) not null, primary key
  7. # account_id :bigint(8) not null
  8. # target_account_id :bigint(8) not null
  9. # created_at :datetime not null
  10. # updated_at :datetime not null
  11. #
  12. class FollowRecommendationMute < ApplicationRecord
  13. belongs_to :account
  14. belongs_to :target_account, class_name: 'Account'
  15. validates :target_account, uniqueness: { scope: :account_id }
  16. after_commit :invalidate_follow_recommendations_cache
  17. private
  18. def invalidate_follow_recommendations_cache
  19. Rails.cache.delete("follow_recommendations/#{account_id}")
  20. end
  21. end