relationship_cacheable.rb 355 B

12345678910111213141516
  1. # frozen_string_literal: true
  2. module RelationshipCacheable
  3. extend ActiveSupport::Concern
  4. included do
  5. after_commit :remove_relationship_cache
  6. end
  7. private
  8. def remove_relationship_cache
  9. Rails.cache.delete(['relationship', account_id, target_account_id])
  10. Rails.cache.delete(['relationship', target_account_id, account_id])
  11. end
  12. end