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.

16 lines
359 B

  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