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.
 
 
 
 

33 lines
762 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: account_domain_blocks
  5. #
  6. # id :bigint(8) not null, primary key
  7. # domain :string
  8. # created_at :datetime not null
  9. # updated_at :datetime not null
  10. # account_id :bigint(8)
  11. #
  12. class AccountDomainBlock < ApplicationRecord
  13. include Paginable
  14. include DomainNormalizable
  15. belongs_to :account
  16. validates :domain, presence: true, uniqueness: { scope: :account_id }
  17. after_commit :remove_blocking_cache
  18. after_commit :remove_relationship_cache
  19. private
  20. def remove_blocking_cache
  21. Rails.cache.delete("exclude_domains_for:#{account_id}")
  22. end
  23. def remove_relationship_cache
  24. Rails.cache.delete_matched("relationship:#{account_id}:*")
  25. end
  26. end